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?

3

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.