Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 year ago by CosmicKeeper286

Django Admin Static Files Not Loading When DEBUG Is False

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I deployed my Django app with DEBUG set to False, and although static files load correctly on the main website, the admin page is missing them. Below are my settings and URL configurations for reference:

Screenshot of the admin page:

[Screenshot 2024-02-02 at 1.09.29 PM

Screenshot 2024-02-02 at 1.09.29 PM1928×1138 119 KB](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/2/f/2fc818b4b7e6c3743a3d81462076472e144387e7.png "Screenshot 2024-02-02 at 1.09.29 PM")

settings.py:

PYTHON
STATIC_URL = '/static/' if DEBUG: STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),] else: STATIC_ROOT = os.path.join(BASE_DIR, 'static')

urls.py:

PYTHON
urlpatterns = [ path('admin/', admin.site.urls), path('', home_view, name='home'), path('about/', about_view, name='about'), path('members/', members_view, name="members"), path('contact/', contact_view, name="contact"), ] + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT) urlpatterns += staticfiles_urlpatterns()

I appreciate any suggestions on how to resolve this issue.

0

Comments 0

Answers 0

Views 870

0 Answers

Discussion

No comments yet.