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:
Roberto Rosario
2019-04-12 01:53:06 -04:00
parent fab94319bb
commit 1fa91f0ef7
6 changed files with 61 additions and 24 deletions

View File

@@ -20,7 +20,8 @@
* Split trashed document views into their own module.
* Show entire sys trace when an App import exception is raised.
* Remove Django suit from requirements.
* Remove development URLs from main URL file.
3.1.11 (2019-04-XX)
===================
* Fix multiple tag selection wizard step.

View File

@@ -27,6 +27,15 @@ The role permission grant and revoke permissions were removed. Instead only the
role edit permission is required to grant or revoke permissions to a role.
Development
^^^^^^^^^^^
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.
Other changes
^^^^^^^^^^^^^

View File

@@ -10,14 +10,26 @@ CELERY_ALWAYS_EAGER = True
CELERY_EAGER_PROPAGATES_EXCEPTIONS = CELERY_ALWAYS_EAGER
if 'rosetta' not in INSTALLED_APPS:
INSTALLED_APPS += (
'rosetta',
)
try:
import rosetta
except ImportError:
pass
else:
INSTALLED_APPS += (
'rosetta',
)
if 'django_extensions' not in INSTALLED_APPS:
INSTALLED_APPS += (
'django_extensions',
)
try:
import django_extensions
except ImportError:
pass
else:
INSTALLED_APPS += (
'django_extensions',
)
ROOT_URLCONF = 'mayan.urls.development'
TEMPLATES[0]['OPTIONS']['loaders'] = (
'django.template.loaders.filesystem.Loader',

3
mayan/urls/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from __future__ import unicode_literals
from .base import * # NOQA

View File

@@ -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
@@ -9,6 +8,8 @@ from rest_framework import permissions
from mayan.apps.rest_api.schemas import openapi_info
__all__ = ('urlpatterns',)
admin.autodiscover()
schema_view = get_schema_view(
openapi_info,
@@ -23,18 +24,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
View 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))
]