URLs: Remove development URLs from main URL file
Move the development URL definitions for Rosetta and Debug toolbar to a separate URL file. Convert the single urls.py to a module to allow multiple URL files to be used. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -19,6 +19,8 @@ if 'django_extensions' not in INSTALLED_APPS:
|
||||
'django_extensions',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'mayan.urls.development'
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = (
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
|
||||
3
mayan/urls/__init__.py
Normal file
3
mayan/urls/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .base import * # NOQA
|
||||
@@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
|
||||
from drf_yasg.views import get_schema_view
|
||||
@@ -23,18 +22,3 @@ urlpatterns = [
|
||||
url(r'^swagger/$', schema_view.with_ui('swagger', cache_timeout=None), name='schema-swagger-ui'),
|
||||
url(r'^redoc/$', schema_view.with_ui('redoc', cache_timeout=None), name='schema-redoc'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
from django.conf.urls.static import static
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
if 'rosetta' in settings.INSTALLED_APPS:
|
||||
urlpatterns += [
|
||||
url(r'^rosetta/', include('rosetta.urls'), name='rosetta')
|
||||
]
|
||||
|
||||
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
urlpatterns += [
|
||||
url(r'^__debug__/', include(debug_toolbar.urls))
|
||||
]
|
||||
26
mayan/urls/development.py
Normal file
26
mayan/urls/development.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from .base import * # NOQA
|
||||
|
||||
if 'rosetta' in settings.INSTALLED_APPS:
|
||||
try:
|
||||
import rosetta # NOQA
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
urlpatterns += [ # NOQA
|
||||
url(r'^rosetta/', include('rosetta.urls'), name='rosetta')
|
||||
]
|
||||
|
||||
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
||||
try:
|
||||
import debug_toolbar
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
urlpatterns += [ # NOQA
|
||||
url(r'^__debug__/', include(debug_toolbar.urls))
|
||||
]
|
||||
Reference in New Issue
Block a user