我正在关注如何在 Ubuntu 18.04 上使用 Postgres、Nginx 和 Gunicorn 设置 Django 指南。
\n\n我创建了以下文件 .socket
\n\nsudo nano /etc/systemd/system/gunicorn.socket
[Unit]\nDescription=gunicorn socket\n\n[Socket]\nListenStream=/run/gunicorn.sock\n\n[Install]\nWantedBy=sockets.target\nRun Code Online (Sandbox Code Playgroud)\n\n我创建了以下文件 .service
\n\nsudo nano /etc/systemd/system/gunicorn.service
指南中的原始 RECOMENDED_FORMATTING-s
\n\n[Unit]\nDescription=gunicorn daemon\nRequires=gunicorn.socket\nAfter=network.target\n\n\n[Service]\nUser=sammyRECOMENDED_FORMATTING\nGroup=www-data\nWorkingDirectory=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING\nExecStart=/home/sammyRECOMENDED_FORMATTING/myprojectdirRECOMENDED_FORMATTING/myprojectenvRECOMENDED_FORMATTING/bin/gunicorn \\\n --access-logfile - \\\n --workers 3 \\\n --bind unix:/run/gunicorn.sock \\\n myprojectRECOMENDED_FORMATTING.wsgi:application\n\n[Install]\nWantedBy=multi-user.target\nRun Code Online (Sandbox Code Playgroud)\n\n我如何格式化自己的版本我的虚拟环境位于服务器上的项目文件夹之外
\n\n[Unit]\nDescription=gunicorn daemon\nRequires=gunicorn.socket\nAfter=network.target\n\n[Service]\nUser=SERVER_USER\nGroup=www-data\nWorkingDirectory=/home/SERVER_USER/MAIN_PROJECT_FOLDER\nExecStart=/home/SERVER_USER/ven/bin/gunicorn \\\n --access-logfile - \\\n --workers 3 \\\n --bind unix:/home/SERVER_USER/MAIN_PROJECT_FOLDER/MAINAPPLICATION_FOLDER.sock \\\n MAINAPPLICATION_FOLDER.wsgi:application\n\n[Install]\nWantedBy=multi-user.target\nRun Code Online (Sandbox Code Playgroud)\n\n我也尝试过按照最初的建议保留这些
\n\n--bind unix:/run/gunicorn.sock \\
比我尝试执行以下代码
\n\nsudo systemctl start gunicorn
错误信息1
\n\n …18.04 ×1