当前位置: 首页 > 知识库问答 >
问题:

Django uWSGI Nginx

宋臻
2023-03-14

我遵循本教程,但我有一个问题,我得到了502 Nginx错误。

教程链接

我检查了错误日志,上面写着

uwsgi.log

ImportError:没有名为khcards的模块。wsgi

我的uwsgi文件是这样的

[uwsgi]
# variables
projectdomain = khcardsonline.co.uk www.khcardsonline.co.uk

uid = www-data
god = www-data
chmod = 775
# config
plugins = python
master = true
pidfile=/tmp/project-master.pid
chdir = /var/www/example.com/src/khcards
protocol = uwsgi
env = DJANGO_SETTINGS_MODULE=khcards.settings
home = /var/www/example.com/env
pythonpath = /var/www/example.com/src/khcards
module = khcards.wsgi:application
socket = 127.0.0.1:8889
logto = /var/www/example.com/logs/uwsgi.log
#below line runs it as a daemon in background
daemonize = /var/log/uwsgi/khcards.log

我的nginx。形态

服务器{监听80;server_name域www.domain.co.uk;根 /var/www/example.com/src/khcards;access_log /var/www/example.com/logs/access.log;error_log /var/www/example.com/logs/error.log;

location /static/ { # STATIC_URL
    alias /var/www/example.com/src/static/static/; # STATIC_ROOT
    expires 30d;
}

location /media/ { # MEDIA_URL
    alias /var/www/example.com/src/media/; # MEDIA_ROOT
    expires 30d;
}

location / {
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:8889;
}

}

当我奔跑时

重启uwsgi服务

终端吐出来

  • 重新启动应用服务器uwsgi[确定]

但当我这么做的时候

sudo服务nginx重启

终点站吐出了水

Restarting nginx: nginx.

这是否意味着Nginx配置不正确?

共有1个答案

班言
2023-03-14

试着改变

chdir = /var/www/example.com/src/khcards

chdir = /var/www/example.com/src
 类似资料:

相关问答

相关文章

相关阅读