|
@@ -1,13 +1,14 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
+from django.apps import apps
|
|
|
from django.conf import settings
|
|
|
from django.conf.urls import patterns, include, url
|
|
|
from django.conf.urls.static import static
|
|
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
|
|
|
|
|
from coin import views
|
|
|
-
|
|
|
+import coin.apps
|
|
|
|
|
|
import autocomplete_light
|
|
|
autocomplete_light.autodiscover()
|
|
@@ -17,6 +18,17 @@ admin.autodiscover()
|
|
|
|
|
|
from coin.isp_database.views import isp_json
|
|
|
|
|
|
+
|
|
|
+def apps_urlpatterns():
|
|
|
+ """ Yields url lists ready to be appended to urlpatterns list
|
|
|
+ """
|
|
|
+ for app_config in apps.get_app_configs():
|
|
|
+ if isinstance(app_config, coin.apps.AppURLs):
|
|
|
+ for prefix, pats in app_config.exported_urlpatterns:
|
|
|
+ yield url(
|
|
|
+ r'^{}/'.format(prefix),
|
|
|
+ include(pats, namespace=prefix))
|
|
|
+
|
|
|
urlpatterns = patterns(
|
|
|
'',
|
|
|
url(r'^$', 'coin.members.views.index', name='home'),
|
|
@@ -25,7 +37,6 @@ urlpatterns = patterns(
|
|
|
url(r'^members/', include('coin.members.urls', namespace='members')),
|
|
|
url(r'^billing/', include('coin.billing.urls', namespace='billing')),
|
|
|
url(r'^subscription/', include('coin.offers.urls', namespace='subscription')),
|
|
|
- url(r'^vpn/', include('vpn.urls', namespace='vpn')),
|
|
|
|
|
|
url(r'^admin/', include(admin.site.urls)),
|
|
|
|
|
@@ -40,3 +51,5 @@ urlpatterns = patterns(
|
|
|
urlpatterns += staticfiles_urlpatterns()
|
|
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
|
|
+# Pluggable apps URLs
|
|
|
+urlpatterns += list(apps_urlpatterns())
|