我必须测试现有的金字塔应用程序。
我必须设置一个带有一些记录的数据库的本地PostgreSQL服务器。
然后我必须建立一个python虚拟环境并启动现有金字塔应用程序的web服务器。
应用程序已启动并在localhost中运行但是当我尝试通过网页在连接的(!)数据库中添加记录时,我收到错误。我想它没有连接到db。
因为我是Pyramid和PostgreSQL的新手,我可以遵循任何教程吗?
我遵循的步骤是:
设置本地PostgreSQL服务器。
设置python虚拟环境并启动金字塔应用程序的Web服务器(在不同的终端中)。
错误: pserve development.ini 在PID 13630中启动服务器。 在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": ...
答案 0 :(得分:0)
您尝试查询不存在的SQL表records
。
无论
使用PostgreSQL客户端(命令行客户端)在数据库中创建此表
如果您认为该表应该已经存在,那么修复您的SQL查询以进行拼写并参考正确的表
pgcli - 更好的PostgreSQL命令行界面