这是settings配置,换成注释部分也不行
uploads下的文件可以访问,但是static下都是404
同样的配置manage.py runserver后台没问题,但是用uwsgi部署就出问题
以下是uwsgi
# mysite_uwsgi.ini file
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/zc/blogtest
# Django's wsgi file
module = blogtest.wsgi
# the virtualenv (full path)
home = /home/zc/blogtest/blogtestenv
pythonpath = /usr/bin/python3
# process-related settings
# master
master = true
# maximum number of worker processes
processes = 3
# the socket (use the full path to be safe
socket = /home/zc/blogtest/blogtest.sock
下边是nginx
location /media {
alias /home/zc/blogtest/uploads; # your Django project's media files - amend as required
}
location /static {
alias /home/zc/blogtest/static; # your Django project's static files - amend as required;
}
好像django里边STATICFILES_DIRS里边不能包括STATIC_ROOT会报错,所以我把root改成了statics,部署的时候再改回来