我在Django CMS中开发了网站。
使用manage.py runserver
运行它时效果很好,但是当我尝试使用nginx和uwsgi运行它时,我收到以下错误:
在include()的情况下,view必须是callable或list / tuple。
我认为问题可能是我在virtualenv
中运行django cms。
我为另一个django项目使用了相同的conf文件,但它不在virtualenv中
我在virtualenv中启动了uwsgi。
我的wsgi.ini :
[uwsgi]
chdir = /var/www/user.name/mysite
module = mysite.wsgi
#home = /var/www/user
master = true
processes = 10
socket = /var/www/user/mysite/mysite.sock
chmod-socket = 666
vcuum = true
我的nginx conf
upstream django {
server unix:///var/www/user/mysite/mysite.sock;
}
server{
# listen on port
listen 80 default_server;
listen [::]:80 default_server;
server_name example.name www.example.name;
return 301 https://$server_name$request_uri;
}
server{
#Default server?
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.name www.example.name;
charset utf-8;
client_max_body_size 75M;
ssl_certificate /etc/letsencrypt/live/user/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user/privkey.pem;
include snippets/ssl-params.conf;
location ^~ /.well-known{
allow all;
alias /var/www/user/.well-known;
}
location /static {
alias /var/www/user/mysite/mysite/static;
}
location / {
uwsgi_pass django;
include /var/www/user/mysite/uwsgi_params;
}
}
答案 0 :(得分:0)
您需要向wsgi.ini添加虚拟环境路径,类似于:
home = /var/www/myvenv
但我不知道这是否会解决它