我必须测试现有的金字塔应用程序。在
我必须建立一个本地PostgreSQL服务器,其中包含一些记录的数据库。在
然后,我必须设置一个python虚拟环境,并为现有的pyramid应用程序启动web服务器。在
应用程序已在localhost中启动并运行,但当我尝试在连接的(!)中添加记录时数据库通过网页我收到错误。我想它没有连接到数据库。在
因为我是新来的金字塔和PostgreSQL,有什么教程我可以遵循吗?在
我遵循的步骤是:
安装本地PostgreSQL server。在
设置python虚拟环境并启动金字塔应用程序的web服务器(在另一个终端中)。在
错误: 服务开发.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": ...
您试图查询不存在的SQL表
records
。在或者
使用PostgreSQL客户端(命令行客户端)在数据库中创建此表。
如果您认为该表应该已经存在,请修复SQL查询的拼写并引用正确的表
pgcli-更好的PostgreSQL命令行界面
相关问题 更多 >
编程相关推荐