请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

使用uwsgj 启动,静态文件不能加载

我的 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,图片无法加载

正在回答 回答被采纳积分+3

1回答

bobby 2017-04-26 17:35:28

需要先确定一下 静态文件是404 还是500错误


0 回复 有任何疑惑可以回复我~
  • 提问者 我就是人才 #1
    404错误
    回复 有任何疑惑可以回复我~ 2017-04-26 20:38:21
  • bobby 回复 提问者 我就是人才 #2
    是否运行了collect命令将静态文件统一放到一个目录下面 以及看一下nginx的日志看一下是否是有权限问题
    回复 有任何疑惑可以回复我~ 2017-04-27 18:01:38
  • 问题如提问,静态文件404,请问是需要修改文件权限么?该如何修改呢
    回复 有任何疑惑可以回复我~ 2017-04-28 17:04:08
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信