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.
Asked 1 year ago by CosmicKeeper286
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 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:
PYTHONSTATIC_URL = '/static/' if DEBUG: STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),] else: STATIC_ROOT = os.path.join(BASE_DIR, 'static')
urls.py:
PYTHONurlpatterns = [ 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.
Comments 0
•Answers 0
•Views 870
No comments yet.