Try a different way to edit the urlconf

This commit is contained in:
James Polley 2018-06-24 22:39:04 +10:00
parent dc6c8077ad
commit bdc976d77b
4 changed files with 17 additions and 5 deletions

View file

@ -5,3 +5,5 @@ AUTHENTICATION_BACKENDS = [
]
LOGIN_URL='/accounts/login'
ROOT_URLCONF = "pinaxcon.devmode_urls"

11
pinaxcon/devmode_urls.py Normal file
View file

@ -0,0 +1,11 @@
from django.conf.urls import include, url
from django.contrib.auth.views import login, logout
from pinaxcon import urls
urlpatterns = [
url(r'^accounts/logout', logout, {'template_name': 'admin/logout.html'}),
url(r'^accounts/login', login, {'template_name': 'admin/login.html'}),
]
urlpatterns += urls.urlpatterns

View file

@ -170,7 +170,10 @@ MIDDLEWARE_CLASSES = [
'pinaxcon.monkey_patch.MonkeyPatchMiddleware',
]
ROOT_URLCONF = "pinaxcon.urls"
if DEV_MODE and DEV_MODE == "LAPTOP":
ROOT_URLCONF = "pinaxcon.devmode_urls"
else:
ROOT_URLCONF = "pinaxcon.urls"
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = "pinaxcon.wsgi.application"

View file

@ -36,9 +36,5 @@ urlpatterns = [
if settings.DEBUG:
import debug_toolbar
urlpatterns.insert(0, url(r'^__debug__/', include(debug_toolbar.urls)))
if settings.DEV_MODE:
from django.contrib.auth.views import login, logout
urlpatterns.insert(0, url(r'^accounts/logout', logout, {'template_name': 'admin/logout.html'}))
urlpatterns.insert(0, url(r'^accounts/login', login, {'template_name': 'admin/login.html'}))
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)