Skip to content Skip to sidebar Skip to footer

Django Admin Page Missing Css In Iis

I am getting a similar error to this post, but it only happens when I go to the website I set up in IIS 2012R2. I am following this tutorial to start a web app, and I used this vid

Solution 1:

You should set your STATICFILES_DIRS settings in settings.py, to map to your static folder, where CSS, JS and images are stored.

STATIC_URL = 'http://www.example.com/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR,  'static'),
)

Also if you run 'manage.py collectstatic' you should define

STATIC_ROOT = "/path/to/static/destination/folder/"

This is the best way to serve static files.

Reference for STATIC settings: Django Documentation

Solution 2:

I was able to find an answer with the help of a colleague.

The answer is highlighted here: Link

If you follow the above solution, please keep in mind the following (which is what the above person mentioned):

  • The Static folder where you keep all the CSS, jpegs, etc files is not the same as the static folder they are referring to in the solution
  • Make sure you run the command collectstatic to compile all the static files from the STATIC_URL folder to the STATIC_ROOT folder
  • When you run the collectstatic it will compile the Admin static files as well

Post a Comment for "Django Admin Page Missing Css In Iis"