I
I
Infinite2017-08-28 11:03:55
Layout
Infinite, 2017-08-28 11:03:55

How to set correct path to Django admin styles on production server?

After python manage.py collectstatic they appear in the /static/static/admin/css folder , but the admin itself tries to find them in /static/admin/css
setting.py

root = lambda *dirs: join(abspath(BASE_DIR), *dirs)

STATIC_ROOT = root("static","static")
STATIC_URL = "/static/"

# Additional locations of static files
STATICFILES_DIRS = [
    root("static"),
    root("media")
]

STATICFILES_FINDERS = [
    "django.contrib.staticfiles.finders.FileSystemFinder",
    "django.contrib.staticfiles.finders.AppDirectoriesFinder",
]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxfox, 2017-08-28
@Infinite

You need to configure the web server to return static from the folder where this static is located.
STATIC_URL tells the browser to look for statics at the URL '/static/'.
So configure the web server so that it sends files from the folder where they are at this URL.
Everything is written here:
https://docs.djangoproject.com/en/1.11/howto/dep...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question