Instead of inserting the path of the apps into the Python app, the apps are now referenced by their full import path. This solves name clashes with external or native Python libraries. Example: Mayan statistics app vs. Python new statistics library. Every app reference is now prepended with 'mayan.apps'. Existing config.yml files need to be updated manually. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from __future__ import unicode_literals
|
|
|
|
from django.conf import settings
|
|
from django.conf.urls import include, url
|
|
from django.contrib import admin
|
|
|
|
from drf_yasg.views import get_schema_view
|
|
from rest_framework import permissions
|
|
|
|
from mayan.apps.rest_api.schemas import openapi_info
|
|
|
|
admin.autodiscover()
|
|
schema_view = get_schema_view(
|
|
openapi_info,
|
|
validators=['flex', 'ssv'],
|
|
public=True,
|
|
permission_classes=(permissions.AllowAny,),
|
|
)
|
|
|
|
urlpatterns = [
|
|
url(r'^admin/', admin.site.urls),
|
|
url(r'^swagger(?P<format>.json|.yaml)$', schema_view.without_ui(cache_timeout=None), name='schema-json'),
|
|
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))
|
|
]
|