哪里可以找到uwsgi.conf时uwsgi安装在virtualenv中

问题描述:

我到处找uwsgi的描述,他们说,conf文件中可以找到的/ etc/uwsgi /。但我在我的virtualenv安装uwsgi打,所以在/ etc哪里可以找到uwsgi.conf时uwsgi安装在virtualenv中

你可以把你想要的uWSGI配置文件中没有这样的文件夹。该路径不是硬编码的。你看到的主要是分发包的约定或系统管理员的口味。

+0

但它怎么然后读? – Christoffer 2014-09-26 15:09:21

+0

阅读文档:https://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html问这个问题之前,这里 – roberto 2014-09-26 15:22:09

+0

多次阅读。如果您已经知道文档的内容,文档才有意义。 – Christoffer 2014-09-29 14:54:28

没有uwsgi.conf文件自动生成。所以你必须创建你自己的。

看来你必须在本地安装uwsgi两者(在virtualenv中)和全球。然后创建一个uwsgi_my_app.conf文件并将其放入/ etc/init文件夹中。此文件应包含:

description "uwsgi my_app instance" 
start on runlevel [2345] 
stop on runlevel [06] 

exec uwsgi --ini /etc/uwsgi/apps-enabled/my_app.ini 

然后做出my_app.ini文件/ etc/uwsgi /启用应用程序,(你也必须创建这个目录),你uwsgi设置。例如:

[uwsgi] 
uid = www-data 
gid = www-data 

# the virtualenv (full path) 
virtualenv = path/to/venv 
# Project path 
chdir = path/to/my_app 
# Django's wsgi file (path starting from chdir/) 
wsgi-file = my_app/wsgi.py 

# the socket (use the full path to be safe) 
socket = /tmp/uwsgi.sock 
# ... with appropriate permissions 
chmod-socket = 664 

logto = path/to/logs/uwsgi.log 

enable-threads = true 
single-interpreter = true 
thunder-lock = true 
die-on-term = true 
master = true 

threads = 5 
processes = 2 
max-requests = 1000 
buffer-size = 32768 
post-buffering = 8192 

# clear environment on exit 
vacuum = true 

现在你可以开始/停止/重启uwsgi有:

sudo service start uwsgi_my_app