I have to test an existing pyramid application.
I have to set up a local PostgreSQL server with a database with some records.
Then I have to set up a python virtual environment and start web-server for the existing pyramid application.
The application is up and running in localhost but when I try to add a record in the connected(!) db through the web page I receive errors. I suppose that its not connected to the db.
Because I am new with Pyramid and PostgreSQL is there any tutorial which I can follow?
The steps I followed were:
Setup the local PostgreSQL server.
Setup the python virtual environment and start the web-server for the pyramid application (in a different terminal).
ERRORS: pserve development.ini Starting server in PID 13630. serving on http://0.0.0.0:8080
2015-11-22 19:49:10,965 ERROR [waitress][waitress] Exception when serving /get_records
Traceback (most recent call last):
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/channel.py", line 336, in service
task.service()
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 169, in service
self.execute()
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 388, in execute
app_iter = self.channel.server.application(env, start_response)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 223, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 198, in invoke_subrequest
response = handle_request(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/tweens.py", line 20, in excview_tween
response = handler(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid_tm-0.12-py2.7.egg/pyramid_tm/__init__.py", line 99, in tm_tween
reraise(*exc_info)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid_tm-0.12-py2.7.egg/pyramid_tm/__init__.py", line 80, in tm_tween
response = handler(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 145, in handle_request
view_name
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/view.py", line 541, in _call_view
response = view_callable(context, request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/config/views.py", line 351, in rendered_view
result = view(context, request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/config/views.py", line 505, in _requestonly_view
response = view(request)
File "/home/atroul/pyramid_sites/wsyscore/wsyscore/views.py", line 44, in get_records
records = base.database.get_records()
File "/home/atroul/pyramid_sites/wsyscore/wsyscore/Database.py", line 107, in get_records
cursor.execute(sql_sentense, ids)
ProgrammingError: relation "records" does not exist
LINE 1: select * from records;
^
2015-11-22 19:49:12,783 ERROR [waitress][waitress] Exception when serving /record/create_new_record
Traceback (most recent call last):
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/channel.py", line 336, in service
task.service()
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 169, in service
self.execute()
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/waitress-0.8.10-py2.7.egg/waitress/task.py", line 388, in execute
app_iter = self.channel.server.application(env, start_response)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 223, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 198, in invoke_subrequest
response = handle_request(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/tweens.py", line 20, in excview_tween
response = handler(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid_tm-0.12-py2.7.egg/pyramid_tm/__init__.py", line 99, in tm_tween
reraise(*exc_info)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid_tm-0.12-py2.7.egg/pyramid_tm/__init__.py", line 80, in tm_tween
response = handler(request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/router.py", line 145, in handle_request
view_name
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/view.py", line 541, in _call_view
response = view_callable(context, request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/config/views.py", line 351, in rendered_view
result = view(context, request)
File "/home/atroul/pyramid_sites/env/local/lib/python2.7/site-packages/pyramid-1.6b2-py2.7.egg/pyramid/config/views.py", line 505, in _requestonly_view
response = view(request)
File "/home/atroul/pyramid_sites/wsyscore/wsyscore/views.py", line 141, in create_new_record
record_id = base.database.init_record(main_template)
File "/home/atroul/pyramid_sites/wsyscore/wsyscore/Database.py", line 62, in init_record
cursor.execute(sql_sentense, [psycopg2.extras.Json(initial_record['main'])])
ProgrammingError: relation "records" does not exist
LINE 1: INSERT INTO records (seq, main) VALUES (0, '{"first_names": ...
You try to query SQL table records
which does not exist.
Either
Create this table in your database using PostgreSQL clients (command line client)
If you think the table should already exist then fix your SQL query for spelling and refer to correct tables
pgcli - better command line interface for PostgreSQL
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments