金字塔uWSGI部署而不是可迭代的“路由器”

时间:2013-07-10 12:40:34

标签: python pyramid uwsgi

嘿,我在使用uWSGI部署我的应用时遇到问题:

frontend.ini

[uwsgi]
http = *.*.*.*:8181
master = true

#uid = uwsgiuser
#gid = uwsgiuser

processes = 1

harakiri = 60
harakiri-verbose = true
limit-post = 65536
post-buffering = 8192

listen = 128

max-requests = 1000

reload-on-as = 128
reload-on-rss = 96
no-orphans = true

log-slow = true
plugins = python
module = skysoccer.app:main
wsgi-file = /wsgi.py

pythonpath = /eggs/*.egg
pythonpath = /*
pythonpath = *
pythonpath = skysoccer/*
stats= *.*.*.*:8080

这就是我得到的: http://pastebin.com/KBhMnFv7

然后当我输入webbrowser:http:// 。*。*:8181 /

在cli我得到:

TypeError: 'Router' object is not iterable
[pid: 13692|app: 0|req: 1/1] *.*.*.* () {36 vars in 630 bytes} [Wed Jul 10 14:36:31 2013] GET / => generated 0 bytes in 737 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)

在代码中我没有可变“路由器”。

1 个答案:

答案 0 :(得分:0)

我认为您不需要module选项,而只需要wsgi.py文件,将您的wsgi应用程序公开为application变量。

为此,典型的wsgi.py文件可能如下所示:

import os.path

from pyramid.paster import get_app
from pyramid.paster import setup_logging

here = os.path.dirname(os.path.abspath(__file__))
inipath = os.path.join(here, 'production.ini')

setup_logging(inipath)
application = get_app(inipath)

这会将您的应用配置为加载与production.ini文件位于同一文件夹中的wsgi.py文件。