好的,我是Python / Flask部署的新手,并且正在关注this教程。
这是我的系统文件:
[Unit]
Description=Gunicorn instance to serve myapp
After=network.target
[Service]
User=deployer
Group=www-data
WorkingDirectory=/home/deployer/myapp
Environment="PATH=/home/deployer/myapp/myapp_env/bin"
ExecStart=/home/deployer/myapp/myapp_env/bin/gunicorn --workers 3 --bind unix:myapp.sock -m 007 appserver:gunicorn_app
[Install]
WantedBy=multi-user.target
但是它不起作用。我得到Main process exited, code=exited, status=203/EXEC
或/root/myapp/myapp_env/bin/python3: bad interpreter: Permission denied
如果我cd
进入myapp目录并发出gunicorn命令,如下所示:
gunicorn --workers 3 --bind unix:smarrttrader_api.sock -m 007 appserver:gunicorn_app
一切正常。如果我从我的应用程序目录中进行了操作,那么我会得到/usr/local/bin/gunicorn
并尝试从服务器的其他位置运行(),如下所示:
/usr/local/bin/gunicorn --workers 3 --bind unix:smarrttrader_api.sock -m 007 appserver:gunicorn_app
它不起作用,并且出现以下错误:ImportError: No module named 'appserver'
,那么如何使它起作用?