如何告诉systemd启动的uWSGI守护进程使用特定的python?

时间:2017-10-06 22:50:18

标签: python django virtualenv uwsgi

我从在线示例拼凑了下面的 uWSGI 配置文件。 (◠﹏◠)

鉴于此配置 - 位于/etc/uwsgi.d/myapp.ini,用于启动uwsgi守护程序,反过来myapp通过systemd/systemctl - 告诉它使用myapp的特定虚拟环境PYTHON?

home =吗?

换句话说,当它调用django.wsgi应用程序时,如何判断它(或者它如何知道)?/home/myapp_unixHome/.virtualenvs/myapp/bin/python

[uwsgi]

# =======================================================
# Directories ...
# =======================================================
home       =    /home/myapp_unixHome/.virtualenvs/myapp/  <--- Python virtualenv dir.
chdir      =    /home/myapp_unixHome/myapp/               <--- Django App here.
wsgi-file  =    /home/myapp_unixHome/myapp/django.wsgi    <--- Including this django.wsgi file.
static-map = /m=/home/myapp_unixHome/myapp/static/        <--- Static files.
# =======================================================

# =======================================================
# TO BE NAMED ...
# =======================================================
master = true
processes = 5
# =======================================================

# =======================================================
# myapp communicates w/ nginx via a UNIX domain socket.
# =======================================================
socket       = /run/uwsgi/myapp.sock
chmod-socket = 664
uid          = nginx
gid          = nginx
vacuum       = true
# =======================================================

# =======================================================
# uWSGI Log file.
# =======================================================
logto = /var/log/uwsgi.log
# =======================================================

谢谢。

1 个答案:

答案 0 :(得分:2)

是的,请查看此链接http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html

$config ['newline'] = "\r\n";

我希望它有所帮助