使用uwsgj 启动,静态文件不能加载
来源:14-3 uwsgi配置文件方式启动以及代码更新后的重启
我就是人才
2017-04-26
我的 uc_nginx.conf 配置
# the upstream component nginx needs to connect to
upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name www.zzhjxy.cn ; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /root/wangzhan/media; }
location /static {
alias /root/wangzhan/static;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params; # the uwsgi_params file you installed
}
}
我的uwsgi.ini
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /root/wangzhan
# Django's wsgi file
module = wangzhan.wsgi
# the virtualenv (full path)
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 10
# the socket (use the full path to be safe
socket = 127.0.0.1:8000
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
virtualenv = /root/.virtualenvs/mxonline
static_root
也配好了。也ccollectstatic
了,使用域名可以访问,就是静态文件,js,css,图片无法加载
1回答
-
bobby
2017-04-26
需要先确定一下 静态文件是404 还是500错误
052017-10-24
相似问题