mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	Only provide static redirects if in DEBUG mode
This commit is contained in:
		@@ -161,18 +161,20 @@ urlpatterns = [
 | 
				
			|||||||
    url(r'^markdownx/', include('markdownx.urls')),
 | 
					    url(r'^markdownx/', include('markdownx.urls')),
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Static file access
 | 
					# Server running in "DEBUG" mode?
 | 
				
			||||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
 | 
					if settings.DEBUG:
 | 
				
			||||||
 | 
					    # Static file access
 | 
				
			||||||
 | 
					    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Media file access
 | 
					    # Media file access
 | 
				
			||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 | 
					    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Debug toolbar access (if in DEBUG mode)
 | 
					    # Debug toolbar access (only allowed in DEBUG mode)
 | 
				
			||||||
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
 | 
					    if 'debug_toolbar' in settings.INSTALLED_APPS:
 | 
				
			||||||
    import debug_toolbar
 | 
					        import debug_toolbar
 | 
				
			||||||
    urlpatterns = [
 | 
					        urlpatterns = [
 | 
				
			||||||
        path('__debug/', include(debug_toolbar.urls)),
 | 
					            path('__debug/', include(debug_toolbar.urls)),
 | 
				
			||||||
    ] + urlpatterns
 | 
					        ] + urlpatterns
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Send any unknown URLs to the parts page
 | 
					# Send any unknown URLs to the parts page
 | 
				
			||||||
urlpatterns += [url(r'^.*$', RedirectView.as_view(url='/index/', permanent=False), name='index')]
 | 
					urlpatterns += [url(r'^.*$', RedirectView.as_view(url='/index/', permanent=False), name='index')]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user