Alaa-1989 / Linux-ubuntu-server

Make server AWS and Deploying a Flask WebApp
MIT License
0 stars 0 forks source link

python seeder.py #1

Open hostingshades-nitin opened 5 years ago

hostingshades-nitin commented 5 years ago

root@ip-172-26-3-60:/var/www/catalog/catalog# python seeder.py Traceback (most recent call last): File "seeder.py", line 76, in session.commit() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1008, in commit self.transaction.commit() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 487, in commit self._prepare_impl() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 466, in _prepare_impl self.session.flush() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2424, in flush self._flush(objects) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2562, in _flush transaction.rollback(_capture_exception=True) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 67, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2522, in _flush flush_context.execute() File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 416, in execute rec.execute(self) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 583, in execute uow, File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj insert, File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 1116, in _emit_insert_statements statement, params File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 974, in execute return meth(self, multiparams, params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 273, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1093, in _execute_clauseelement distilled_params, File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1234, in _execute_context e, statement, parameters, cursor, context File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1452, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1230, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DataError: (psycopg2.DataError) value too long for type character varying(500) [SQL: 'INSERT INTO items (name, description, price, author, "novelType", "novelPicture", categories_id, user_id) VALUES (%(name)s, %(description)s, %(price)s, %(author)s, %(novelType)s, %(novelPicture)s, %(categories_id)s, %(user_id)s) RETURNING items.id'] [parameters: {'user_id': 1, 'description': 'Robert Langdon, Harvard\nprofessor of symbology and religious iconology, arrives at the ultramodern\nGuggenheim Museum in Bilbao to attend a major an ... (1488 characters truncated) ... idal uncover clues that ultimately bring them face-to-face with Kirsch\'s\nshocking discovery... and the breathtaking truth\nthat has long eluded us.', 'author': 'Dan Brown', 'categories_id': 3, 'price': '$10', 'novelPicture': '../../origin.jpg', 'novelType': 'Mysteries', 'name': 'Origin'}] (Background on this error at: http://sqlalche.me/e/9h9h) root@ip-172-26-3-60:/var/www/catalog/catalog#

and root@ip-172-26-3-60:/var/www/catalog/catalog# python init.py Traceback (most recent call last): File "init.py", line 14, in import requests ImportError: No module named requests root@ip-172-26-3-60:/var/www/catalog/catalog#

when I tried to run the cmd python seeder.py it gives an error please check and guide me for it regards

Nitin Kumar Web Hosting And Email Marketing Consultant. HostingShades Technologies +91-7014206195 www.hostingshades.com

Alaa-1989 commented 5 years ago

hi, In seeder file you got this error ((psycopg2.DataError) value too long for type character varying(500)), that means your data is so long, so you can solve it by deleting some data from the "description", or you can search for some solution to increase the data limit.
In the second error, you need to install requests model by this command " pip install requests" And sorry I've answered you late, just seen your issue now.

hostingshades-nitin commented 5 years ago

Hi, thanks for updating the solution , please can you tell me that how we can delete the data from description .

Nitin Kumar Web Hosting And Email Marketing Consultant. HostingShades Technologies +91-7014206195 www.hostingshades.com On 20 Jan 2019, 2:20 AM +0530, Alaa-1989 notifications@github.com, wrote:

hi, In seeder file you got this error ((psycopg2.DataError) value too long for type character varying(500)), that means your data is so long, so you can solve it by deleting some data from the "description", or you can search for some solution to increase the data limit. In the second error, you need to install requests model by this command " pip install requests" And sorry I've answered you late, just seen your issue now. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Alaa-1989 commented 5 years ago

go to the file you cloned the web app on it, in this project is there "cd /var/www/catalog/catalog" then "sudo nano seeder.py" and you can editing the file, then save it.