问题描述
我正在尝试使用Django
,Gunicorn
和Nginx
将基本应用程序部署到Amazon EC2
.我已将应用程序git clone
放入我的AWS
Ubuntu
实例中,并且正在运行Django 1.10
.
I am trying to deploy a basic application to Amazon EC2
using Django
, Gunicorn
, and Nginx
. I have the app git clone
'd into my AWS
Ubuntu
instance and am running Django 1.10
.
我可以通过以下命令使用Gunicorn
运行我的应用...
I am able to run my app using Gunicorn
with the following command...
gunicorn --bind 0.0.0.0:8000 blackspruceherbals.wsgi:application
尽管在尝试为Gunicorn
创建新贵文件时遇到麻烦.文件路径如下...
I am running into trouble though when I try to create a upstart file for Gunicorn
. The file path is as follows...
/etc/init/gunicorn.conf
,新贵代码如下...
and the upstart code looks like this...
description "Gunicorn application server handling black spruce herbals"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid ubuntu
setgid www-data
chdir /home/ubuntu/websitename/
exec bsh_env/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/websitename/websitename.sock websitename.wsgi:application
我跑步时...
When I run...
sudo service gunicorn start
我收到以下错误...
I get the following error...
Failed to start gunicorn.service: Unit gunicorn.service not found.
Failed to start gunicorn.service: Unit gunicorn.service not found.
有什么作用?我搜寻了互联网以寻找答案,但没有发现任何问题.您能看到明显的地方我做错了吗?预先感谢.
推荐答案
自从Ubuntu 15.04 upstart
被替换为systemd
.您需要创建一个文件/etc/systemd/gunicorn.service
,该文件的语法与upstart
文件不同. FAQ 可以帮助您入门,参考文献为man systemd.service
.
Since Ubuntu 15.04 upstart
has been replaced by systemd
. You need to create a file /etc/systemd/gunicorn.service
, which has a different syntax than the upstart
file. The FAQ can get you started, and the reference is man systemd.service
.
这篇关于无法启动gunicorn.service:未找到单元gunicorn.service的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!