Django Admin CSS missing

后端 未结 11 1109
醉梦人生
醉梦人生 2020-12-24 01:23

I\'ve been messing around with the new collectstatic command and have got it working for my normal pages. That is to say, I am able to load my css at this locat

11条回答
  •  伪装坚强ぢ
    2020-12-24 01:59

    Django recommends that you deploy static files with a web server other than wsgi.

    1. In settings.py, set:

    STATIC_ROOT = 'static'

    1. Run python manage.py collectstatic, which will copy the Django admin static files to /path/to/project/static/

    2. Configure your static file server. If you use Nginx, you could add this config:

      location /static/ {                              
          alias /path/to/project/static/;  
          expires modified +1w;                        
      }  
      
    3. Reload your web server

    You should now have access to the static files.

提交回复
热议问题