-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurls.py
More file actions
61 lines (57 loc) · 2.34 KB
/
urls.py
File metadata and controls
61 lines (57 loc) · 2.34 KB
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
from django.conf import settings
from django.conf.urls import include, url
from django.urls import path, re_path
from splash_app.views import landing
from django.conf.urls.static import static
import importlib
import login_middleware
from django.contrib.auth.decorators import login_required
import os
print('qed.urls')
print("IS_PUBLIC: " + str(os.environ.get('IS_PUBLIC')))
# Workaround import of cyano urls due to dashes in repo name:
cyano = importlib.import_module(".urls", "EPA-Cyano-Web.cyan_django")
cyano_urls = getattr(cyano, 'urlpatterns')
# Storing env vars in os.environ are strings only...
# if bool(os.environ.get('IS_PUBLIC')) and not bool(os.environ.get('UNDER_REVIEW')):
if settings.IN_PROD:
urlpatterns = [
path('', include('splash_app.urls')),
path('cts/', include('cts_app.urls')),
path('hms/', include('hms_app.urls')),
path('pisces/', include('pisces_app.urls')),
path('cyanweb/', include(cyano_urls)),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
elif os.environ.get('IS_PUBLIC') == "True":
urlpatterns = [
path('', include('splash_app.urls')),
path('cts/', include('cts_app.urls')),
# path('cyan/', include('cyan_app.urls')),
path('hms/', include('hms_app.urls')),
# path('hwbi/', include('hwbi_app.urls')),
path('login/', login_middleware.login),
path('nta/', include('nta_app.urls')),
path('pisces/', include('pisces_app.urls')),
path('pram/', include('pram_app.urls')),
path('cyanweb/', include(cyano_urls)),
]
else:
# not public (dev, staging, etc.)
urlpatterns = [
path('', include('splash_app.urls')),
path('cts/', include('cts_app.urls')),
# path('cyan/', include('cyan_app.urls')),
path('hms/', include('hms_app.urls')),
path('hwbi/', include('hwbi_app.urls')),
path('nta/', include('nta_app.urls')),
path('pisces/', include('pisces_app.urls')),
path('pram/', include('pram_app.urls')),
path('login/', login_middleware.login),
path('cyanweb/', include(cyano_urls)),
]
# 404 Error view (file not found)
handler404 = 'splash_app.views.landing.page_404'
# 500 Error view (server error)
handler500 = 'splash_app.views.landing.page_404'
# 403 Error view (forbidden)
handler403 = 'splash_app.views.landing.page_404'