如何在更改的django项目布局中指向wsgi文件 - django

时间:2018-06-11 12:01:59

标签: django gunicorn django-deployment

我改变了我的Django项目布局。现在它看起来像: 在/home/myuser/我有一个名为myproject的文件夹,在此文件夹中有两个文件夹:envsite。并且site文件夹布局如下所示:

`+ apps
 -- accounts
 -- mainp
 -- business
 + config
 -- wsgi.py
 -- urls.py
 ++ settings
    -- base.py
    -- prod.py
    -- local.py

问题在于gunicorn systemd file。这是它的内容:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=myuser
Group=www-data
WorkingDirectory=/home/myuser/myproject
ExecStart=/home/myuser/myproject/env/bin/gunicorn --access-logfile - --workers 4  --bind unix:/home/myuser/myproject/site/site.sock  site.config.wsgi:application

[Install]
WantedBy=multi-user.target

当我重新加载并在sudo systemctl status gunicorn之后重新启动gunicorn之后,我看到了这个错误:

Jun 11 16:11:04 site gunicorn[13589]: ImportError: No module named 'config'
Jun 11 16:11:04 site gunicorn[13589]: [2018-06-11 16:11:04 +0430] [13600] 
[INFO] Worker exiting (pid: 13600)
Jun 11 16:11:04 site systemd[1]: gunicorn.service: Main process exited, 
code=exited, status=1/FAILURE
Jun 11 16:11:04 site systemd[1]: gunicorn.service: Unit entered failed 
state.
Jun 11 16:11:04 site systemd[1]: gunicorn.service: Failed with result 
'exit-code'.

问题是什么?我该如何解决呢?

0 个答案:

没有答案