forked from openwisp/openwisp-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
79 lines (76 loc) · 2.02 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
from django.conf import settings
from django.conf.urls import include, url
url_metadata = [
# allauth proxy
{
'regexp': r'^accounts/',
'app': 'openwisp_users',
'include': {
'module': 'openwisp_users.accounts.urls'
}
},
# django-netjsonconfig schemas
{
'regexp': r'^',
'include': {
'module': 'django_netjsonconfig.urls',
'namespace': 'netjsonconfig'
}
},
# openwisp_controller.pki (CRL view)
{
'regexp': r'^',
'app': 'openwisp_controller.pki',
'include': {
'module': '{app}.urls',
'namespace': 'x509'
}
},
# openwisp_controller.config (get_default_templates)
{
'regexp': r'^',
'app': 'openwisp_controller.config',
'include': {
'module': '{app}.urls',
'namespace': 'config'
}
},
# openwisp_controller controller
{
'regexp': r'^',
'app': 'openwisp_controller.config',
'include': {
'module': '{app}.controller.urls',
'namespace': 'controller'
}
},
# owm_legacy
{
'regexp': r'^',
'app': 'owm_legacy',
'include': {
'module': '{app}.urls',
'namespace': 'owm',
}
},
# openwisp_controller.geo
{
'regexp': r'^',
'app': 'openwisp_controller.geo',
'include': {
'module': '{app}.api.urls',
'namespace': 'geo'
}
},
]
urlpatterns = []
for meta in url_metadata:
module = meta['include'].pop('module')
if 'app' in meta:
# if app attribute is specified, ensure the app is installed, or skip otherwise
# this allows some flexibility during development or when trying custom setups
if meta['app'] not in settings.INSTALLED_APPS:
continue
# DRY python module path
module = module.format(**meta)
urlpatterns.append(url(meta['regexp'], include(module, **meta['include'])))