以 sudo 用户身份设置运行 nginx、gunicorn、django 的新 Ubuntu 15.10 x64 服务器时。我通过运行收到一条错误消息sudo service gunicorn start:
Failed to start gunicorn.service:
Unit gunicorn.service failed to load: No such file or directory.
Run Code Online (Sandbox Code Playgroud)
从活动的 virtualenv 我可以使用以下命令启动 gunicorn:
gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application
Run Code Online (Sandbox Code Playgroud)
关于如何解决这个问题的任何想法将不胜感激,因为我已经尝试了很多来自各种网络搜索的建议,这些建议提到了与此类似的问题,但没有运气。
我的gunicorn文件在/etc/init/gunicorn.conf,配置如下:
description "Gunicorn application server handling myproject"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid myuser
setgid www-data
chdir /home/myuser/myproject
exec myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/myuser/myproject/myproject.sock myproject.wsgi:application
Run Code Online (Sandbox Code Playgroud) server ×1