0

django 1.8 on a production server: When loading the admin page, it shows the content without rendering the css, similar to the site shown here.

There are no errors in chrome developer tools. These 2 css files load fine:

<link href="/static/admin/css/base.7cdd754721f8.css" rel="stylesheet" type="text/css"/>
<link href="/static/admin/css/dashboard.4898e2e9983d.css" rel="stylesheet" type="text/css"/>

Still the admin interface appears unstyled.

Relevant settings:

STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticroot')
STATIC_URL = '/static/'
ABS_TEMPLATES_PATH = PROJECT_ROOT + '/templates'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'project_docs/site'),
)

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
MEDIA_URL = '/media/'

Any suggestions?

Community
  • 1
  • 1
Davy
  • 1,720
  • 1
  • 19
  • 42
  • Can you edit ur Q to add apache/nginx conf file settings. – Abijith Mg May 10 '17 at 04:54
  • I don't have these. My site runs on https://www.pythonanywhere.com These guys configure it for me. I will check with them. – Davy May 10 '17 at 07:11
  • FYI http://help.pythonanywhere.com/pages/StaticFiles/ and http://help.pythonanywhere.com/pages/DjangoStaticFiles/ – Davy May 10 '17 at 18:47

1 Answers1

0

This was caused by wrong css files being loaded.

The mkdocs package (http://www.mkdocs.org/) also has a file called "base.css". Static file collection brought them erroneously to the same place, overwriting the django admin base.css file.

So django admin was loading the mkdocs theme...

Corrected the static file collection so these files do not overwrite each other and the issue is solved.

Davy
  • 1,720
  • 1
  • 19
  • 42