问题描述
我正在尝试在Digital Ocean Ubuntu 16.04服务器上首次使用NGINIX,Gunicorn和Supervisor部署Django Web应用程序。我正在追踪。
I am attempting to deploy a Django web application for the first time using NGINIX, Gunicorn and Supervisor on Digital Ocean Ubuntu 16.04 server. I am following the this linked tutorial.
我在配置Supervisor时遇到了麻烦。运行此命令时...
I am having a trouble configuring Supervisor. When running this command...
sudo supervisorctl status automatedre
我收到此错误...
automatedre FATAL Exited too quickly (process log may have details)
日志文件显示此内容...
The log file shows this...
supervisor: couldn't exec /home/automatedre/gunicorn_start: ENOENT
supervisor: child process was not spawned
supervisor: couldn't exec /home/automatedre/gunicorn_start: ENOENT
supervisor: child process was not spawned
/ home / automatedre / gunicorn_start
#!/bin/bash
NAME="django_automatedre"
DIR=/home/automatedre/automatedre
USER=automatedre
GROUP=automatedre
WORKERS=3
BIND=unix:/home/automatedre/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=automatedre.settings
DJANGO_WSGI_MODULE=automatedre.wsgi
LOG_LEVEL=error
cd $DIR
source ../venv/bin/activate
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH
exec ../venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $WORKERS \
--user=$USER \
--group=$GROUP \
--bind=$BIND \
--log-level=$LOG_LEVEL \
--log-file=-
/etc/supervisor/conf.d/automatedre .conf
[program:automatedre]
command=/home/automatedre/gunicorn_start
user=automatedre
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/automatedre/logs/gunicorn.log
我不确定从这里去哪里。我不认为这是文件权限问题,因为我以前用此方法更改了 gunicorn_start 的权限...
I'm not sure where to go from here. I don't believe it is a file permission issue since I previously changed permission on gunicorn_start with this...
chmod u+x gunicorn_start
关于我要去哪里的任何想法吗?
Any ideas on where I'm going wrong?
推荐答案
我以前从日志文件中省略了下面的文本,因为我认为这没有关系...错误。
I previously left out the text below from the log file because I didn't think it was relevant...mistake.
/home/automatedre/gunicorn_start: 2: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 12: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 13: cd: can't cd to /home/automatedre/automatedre^M
/home/automatedre/gunicorn_start: 14: /home/automatedre/gunicorn_start: source: not found
/home/automatedre/gunicorn_start: 15: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 18: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 19: exec: ../venv/bin/gunicorn: not found
我最初创建了 / home / automatedre / gunicorn_start 和 /etc/supervisor/conf.d/automatedre.conf 在Windows机器上的Brackets文本编辑器中,从而造成了此问题。
I initially created the /home/automatedre/gunicorn_start and /etc/supervisor/conf.d/automatedre.conf in my Brackets text editor on my windows machine which created this issue.
进行更多挖掘之后,我了解到。
After doing some more digging, I learned that Windows/MS-DOS uses CR+LF to indicate end-of-lines and UNIX uses LF character to indicate line termination (EOL character).
此差异导致每行末尾的^ M导致找不到文件路径错误。
This difference resulted in the ^M at the end of each line causing the file path not found error.
使用nano重新从终端重新创建每个文件,就解决了这个问题。
Recreating each file from the terminal with nano solved the issue.
这篇关于主管与ENOENT退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!