<NME> urls.py
<BEF> from functools import reduce

from ckeditor_uploader import views as cku_views

from django.conf import settings

load_settings()

urlpatterns = patterns('',
    (r'^$', 'modoboa.lib.webutils.topredirection'),
    (r'^jsi18n/$', 'django.views.i18n.javascript_catalog',
     {'packages': ('modoboa', ), }),

    (r'^accounts/login/$', 'modoboa.core.views.auth.dologin'),
    (r'^accounts/logout/$', 'modoboa.core.views.auth.dologout'),

    (r'^core/$', 'modoboa.core.views.admin.viewsettings'),
    (r'^core/parameters/$', 'modoboa.core.views.admin.viewparameters'),
    (r'^core/parameters/save/$', 'modoboa.core.views.admin.saveparameters'),
    (r'^core/extensions/$', 'modoboa.core.views.admin.viewextensions'),
    (r'^core/extensions/save/$', 'modoboa.core.views.admin.saveextensions'),
    (r'^core/info/$', 'modoboa.core.views.admin.information'),
    (r'^core/logs/$', 'modoboa.core.views.admin.logs'),

    (r'^user/$', 'modoboa.core.views.user.index'),
    (r'^user/preferences/$', 'modoboa.core.views.user.preferences'),
    (r'^user/profile/$', 'modoboa.core.views.user.profile'),
)

urlpatterns += patterns('',
    *events.raiseQueryEvent("ExtraUprefsRoutes")
)

urlpatterns += patterns('',
    *exts_pool.load_all()
)

parameters.apply_to_django_settings()

if 'modoboa.demo' in settings.INSTALLED_APPS:
    urlpatterns += patterns('',
        (r'^demo/', include('modoboa.demo.urls'))
    )

         name="password_reset"),
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.conf.urls.static import static
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    path('reset/resend_code/',
         core_views.ResendSMSCodeView.as_view(),
         name="password_reset_resend_code"),
    path('reset/<uidb64>/<token>/',
         auth_views.PasswordResetConfirmView.as_view(),
         name="password_reset_confirm"),
    path('reset/done/', auth_views.PasswordResetCompleteView.as_view(),
         name="password_reset_complete"),
]

exts_pool.load_all()
urlpatterns += exts_pool.get_urls()

extra_routes = core_signals.extra_uprefs_routes.send(sender="urls")
if extra_routes:
    extra_routes = reduce(
        lambda a, b: a + b, [route[1] for route in extra_routes])
    urlpatterns += extra_routes

# API urls
urlpatterns += [
    # FIXME: legacy, to remove ASAP
    path('docs/openapi.json',
         SpectacularJSONAPIView.as_view(api_version="v1"), name='schema-v1-legacy'),

    path('api/schema-v1/',
         SpectacularJSONAPIView.as_view(api_version="v1"), name='schema-v1'),
    path('api/schema-v1/swagger/',
         SpectacularSwaggerView.as_view(url_name='schema-v1'),
         name='docs-index-v1'),
    path('api/schema-v1/redoc/',
         SpectacularRedocView.as_view(url_name='schema-v1')),

    path('api/schema-v2/',
         SpectacularJSONAPIView.as_view(api_version="v2"), name='schema-v2'),
    path('api/schema-v2/swagger/',
         SpectacularSwaggerView.as_view(url_name='schema-v2'),
         name='docs-index-v2'),
    path('api/schema-v2/redoc/',
         SpectacularRedocView.as_view(url_name='schema-v2')),
    path('api/v1/', include("modoboa.urls_api_v1", namespace="v1")),
    path('api/v2/', include("modoboa.urls_api_v2", namespace="v2")),
]

if settings.DEBUG:
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.conf.urls.static import static
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(
        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
    )

<MSG> Documentation + various fixes.

<DFF> @@ -6,39 +6,29 @@ from modoboa.core import load_settings
 
 load_settings()
 
-urlpatterns = patterns('',
+urlpatterns = patterns(
+    '',
     (r'^$', 'modoboa.lib.webutils.topredirection'),
     (r'^jsi18n/$', 'django.views.i18n.javascript_catalog',
      {'packages': ('modoboa', ), }),
-
-    (r'^accounts/login/$', 'modoboa.core.views.auth.dologin'),
-    (r'^accounts/logout/$', 'modoboa.core.views.auth.dologout'),
-
-    (r'^core/$', 'modoboa.core.views.admin.viewsettings'),
-    (r'^core/parameters/$', 'modoboa.core.views.admin.viewparameters'),
-    (r'^core/parameters/save/$', 'modoboa.core.views.admin.saveparameters'),
-    (r'^core/extensions/$', 'modoboa.core.views.admin.viewextensions'),
-    (r'^core/extensions/save/$', 'modoboa.core.views.admin.saveextensions'),
-    (r'^core/info/$', 'modoboa.core.views.admin.information'),
-    (r'^core/logs/$', 'modoboa.core.views.admin.logs'),
-
-    (r'^user/$', 'modoboa.core.views.user.index'),
-    (r'^user/preferences/$', 'modoboa.core.views.user.preferences'),
-    (r'^user/profile/$', 'modoboa.core.views.user.profile'),
+    ('', include('modoboa.core.urls')),
 )
 
-urlpatterns += patterns('',
+urlpatterns += patterns(
+    '',
     *events.raiseQueryEvent("ExtraUprefsRoutes")
 )
 
-urlpatterns += patterns('',
+urlpatterns += patterns(
+    '',
     *exts_pool.load_all()
 )
 
 parameters.apply_to_django_settings()
 
 if 'modoboa.demo' in settings.INSTALLED_APPS:
-    urlpatterns += patterns('',
+    urlpatterns += patterns(
+        '',
         (r'^demo/', include('modoboa.demo.urls'))
     )
 
@@ -46,4 +36,6 @@ if settings.DEBUG:
     from django.contrib.staticfiles.urls import staticfiles_urlpatterns
     from django.conf.urls.static import static
     urlpatterns += staticfiles_urlpatterns()
-    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+    urlpatterns += static(
+        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
+    )

Documentation + various fixes.