urls.py 3.29 KB
Newer Older
1
from django.conf import settings
2
from django.conf.urls import url, include
Brian Moe's avatar
Brian Moe committed
3 4

from django.contrib import admin
5
from django.contrib.auth.views import LogoutView
6
from django.views.generic import TemplateView
Brian Moe's avatar
Brian Moe committed
7

8
# Import feeds
Tanner Prestegard's avatar
Tanner Prestegard committed
9
import core.views
10
from events.feeds import EventFeed, feedview
11
import events.reports
12
import events.views
13
from ligoauth.views import (
14
    manage_password, ShibLoginView, ShibPostLoginView
15
)
16
import search.views
17 18 19

# Django admin auto-discover
admin.autodiscover()
20

21 22 23 24
feeds = {
    'latest' : EventFeed
}

25

26
urlpatterns = [
27
    url(r'^$', events.views.index, name="home"),
28 29 30 31 32 33 34 35
    url(r'^navbar_only$', TemplateView.as_view(
        template_name='navbar_only.html'), name="navbar-only"),
    url(r'^SPInfo', TemplateView.as_view(template_name='gracedb/spinfo.html'),
         name="spinfo"),
    url(r'^SPPrivacy', TemplateView.as_view(
        template_name='gracedb/spprivacy.html'), name="spprivacy"),
    url(r'^DiscoveryService', TemplateView.as_view(
        template_name='discovery.html'), name="discovery"),
36
    url(r'^events/', include('events.urls')),
37
    url(r'^superevents/', include('superevents.urls')),
38
    url(r'^alerts/', include('alerts.urls')),
39 40 41
    url(r'^feeds/(?P<url>.*)/$', EventFeed()),
    url(r'^feeds/$', feedview, name="feeds"),

Tanner Prestegard's avatar
Tanner Prestegard committed
42 43
    url(r'^other/$', TemplateView.as_view(template_name='other.html'),
        name='other'),
44 45
    url(r'^performance/$', events.views.performance, name="performance"),
    url(r'^reports/$', events.reports.histo, name="reports"),
46
    url(r'^reports/cbc_report/(?P<format>(json|flex))?$',
47
        events.reports.cbc_report, name="cbc_report"),
48
    url(r'^latest/$', search.views.latest, name="latest"),
49 50
    #(r'^reports/(?P<path>.+)$', 'django.views.static.serve',
    #        {'document_root': settings.LATENCY_REPORT_DEST_DIR}),
51
    url(r'^search/$', search.views.search, name="mainsearch"),
52

53
    # Authentication
54 55
    url(r'^login/$', ShibLoginView.as_view(), name='login'),
    url(r'^post-login/$', ShibPostLoginView.as_view(), name='post-login'),
56
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
57

58 59 60
    # Password management
    url('^manage-password/$', manage_password, name='manage-password'),

61
    # API URLs
62
    url(r'^api/', include('api.urls')),
63
    # Legacy API URLs - must be maintained!
64 65
    url(r'^apibasic/', include('api.urls', namespace='legacy_apibasic')),
    url(r'^apiweb/', include('api.urls', namespace='legacy_apiweb')),
Brian Moe's avatar
Brian Moe committed
66

Tanner Prestegard's avatar
Tanner Prestegard committed
67 68 69
    # Heartbeat URL
    url(r'^heartbeat/$', core.views.heartbeat, name='heartbeat'),

70
    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
Brian Moe's avatar
Brian Moe committed
71 72
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
73
    url(r'^admin/', admin.site.urls),
Brian Moe's avatar
Brian Moe committed
74

75 76
    # Sessions
    url(r'^', include('user_sessions.urls', 'user_sessions')),
77

78
]
79

80 81 82
# We don't require settings.DEBUG for django-silk since running unit tests
# by default setings settings.DEBUG to False, unless you use the
# --debug-mode flag
83
if ('silk' in settings.INSTALLED_APPS):
84 85 86 87 88 89 90
    # Add django-silk
    urlpatterns = [
        url(r'^silk/', include('silk.urls', namespace='silk'))
    ] + urlpatterns

# Add django-debug-toolbar
if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
91
    import debug_toolbar
92
    urlpatterns = [
93
        url(r'^__debug__/', include(debug_toolbar.urls)),
94
    ] + urlpatterns