我是新来的尼克斯,uWSGI和金字塔,我试图通过uWSGI服务金字塔应用程序使用NGINX作为反向代理。我现在真的被困住了,我希望有人能对如何解决这个问题提出一些建议。如果你能解释一下可能发生的事情,那也会有帮助,因为我的理解是非常有限的!
目前,当我访问反向代理URL时,我正在从uWSGI获得一个“内部服务器错误”。在uWSGI错误日志中,我得到了错误:
--- no python application found, check your startup logs for errors ---当我单独通过uWSGI使用pserve启动应用程序时,应用程序工作得很好。我可以从我的虚拟信封启动它,如下所示:
bin/pserve my-app/uwsgi.ini但是当我启动nginx并访问代理地址时,我会得到内部服务器错误。
我在uwsgi.ini中的设置如下:
[app:main]
use = egg:myapp
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid_debugtoolbar
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
[loggers]
keys = root, musiccircle
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = ERROR
handlers = console
[logger_musiccircle]
level = ERROR
handlers =
qualname = musiccircle
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
[uwsgi]
socket = unix://home/usr/env/myapp/myapp.sock
master = true
processes = 48
cpu-affinity = 12
harakiri = 60
post-buffering = 8192
buffer-size = 65535
daemonize = ./uwsgi.log
pidfile = ./pid_5000.pid
listen = 32767
reload-on-as = 512
reload-on-rss = 192
limit-as = 1024
no-orphans = true
reload-mercy = 8
log-slow = true
virtualenv = /home/usr/env在nginx中相应的myapp.conf文件中,我有以下内容:
upstream myapp {
server 127.0.0.1:6543;
}
server {
listen 8080;
server_name myapp.local www.myapp.local;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/usr/env/myapp;
}
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
charset utf-8;
location / {
include uwsgi_params;
uwsgi_pass unix://home/usr/env/myapp/myapp.sock;
}
}如果你还需要看什么,请告诉我。正如您所看到的,Nginx被配置为在端口8080服务(它是这样做的),金字塔应用程序由uWSGI提供到端口6543 (它可以)。
提前谢谢。
发布于 2016-11-30 20:20:13
似乎金字塔项目的目的是安装(setup.py),然后使用.ini配置文件运行pserve。Pserve然后在运行时将这些配置文件细节作为**settings传递给您的金字塔应用程序。
这与没有安装且通常没有配置文件的烧瓶不同。这样的uWSGI应用程序可以根据需要运行,所有运行时配置都由uWSGI或环境变量处理。
由于金字塔通常在运行时需要一个配置文件,并且在使用配置文件(即production.ini)时依赖pserve提供配置文件,所以我认为您必须运行uwsgi --ini-paste production.ini (或者运行Pypy,uwsgi --pypy-paste production.ini) (感谢@Sorrel)
https://stackoverflow.com/questions/31917105
复制相似问题