我使用瓶子来编写一个小的web程序,并将以下源文件命名为index.py
。我也在程序中使用烧杯会话库。当我使用python index.py
运行代码时,一切正常。但当我使用gunicorn -c gunicorn.conf index:app
时,我会收到这样的错误消息,说烧杯密钥{
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/bottle-0.12.7-py2.7.egg/EGG-INFO/scripts/bottle.py", line 857, in _handle
self.trigger_hook('before_request')
File "/Library/Python/2.7/site-packages/bottle-0.12.7-py2.7.egg/EGG-INFO/scripts/bottle.py", line 640, in trigger_hook
return [hook(*args, **kwargs) for hook in self._hooks[__name][:]]
File "/Users/yizeng/Documents/python_projects/simple-courses/index.py", line 17, in setup_request
request.session = request.environ['beaker.session']
KeyError: 'beaker.session'
index.py
的源代码:
我相信您根本不需要最后一个块
if __name...
。Gunicorn以WSIG的身份运行索引模块的应用程序“varibale”意味着它应该启动瓶子应用程序的实例。在相关问题 更多 >
编程相关推荐