REST: sfa API using rest only GetVersion for now
[myslice.git] / myslice / urls.py
1 from django.conf.urls import patterns, include, url
2 from django.conf      import settings
3 from django.contrib import admin
4
5 # Uncomment the next two lines to enable the admin:
6 # from django.contrib import admin
7 # admin.autodiscover()
8
9 # to enable insert_above stuff
10 from django.template.loader import add_to_builtins
11 add_to_builtins('insert_above.templatetags.insert_tags')
12
13 from settings import auxiliaries, INSTALLED_APPS
14
15 import portal.platformsview
16 import portal.dashboardview
17 import portal.homeview
18 import portal.newsview
19
20 from portal.about                   import AboutView
21 from portal.registrationview        import RegistrationView
22 from portal.accountview             import AccountView, account_process
23 from portal.institution             import InstitutionView
24
25 from portal.supportview             import SupportView
26 from portal.contactview             import ContactView
27
28 from portal.termsview               import TermsView
29
30 home_view=portal.homeview.HomeView.as_view()
31 dashboard_view=portal.dashboardview.DashboardView.as_view()
32 platforms_view=portal.platformsview.PlatformsView.as_view()
33
34 #import portal.testbedlist
35 import portal.sliceview
36 import portal.sliceresourceview
37
38 import portal.slicetabexperiment
39 import portal.slicetabinfo
40 import portal.slicetabtestbeds
41 import portal.slicetabusers
42 import portal.slicetabmeasurements 
43
44 import portal.managementtababout
45 import portal.managementtabrequests
46
47 #### high level choices
48 # main entry point (set to the / URL)
49 # beware that if this view is broken you end up in an endless cycle...
50 # maybe platforms_view would be best on the longer run
51 the_default_view=home_view
52 # where to be redirected after login
53 the_after_login_view=dashboard_view
54 # where to redirect when login is required
55 # might need another one ?
56 the_login_view=home_view
57 admin.autodiscover()
58 urls = [
59     '',
60     # Examples:
61     # url(r'^$', 'myslice.views.home', name='home'),
62     # url(r'^myslice/', include('myslice.foo.urls')),
63     # Uncomment the admin/doc line below to enable admin documentation:
64     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
65     # Uncomment the next line to enable the admin:
66      url(r'^admin/', include(admin.site.urls)),
67     #
68     # default / view
69     (r'^/?$', the_default_view),
70     #
71     # login / logout
72     (r'^login-ok/?$', the_after_login_view, {'state': 'Welcome to MySlice'} ),
73     #
74     # seems to be what login_required uses to redirect ...
75     (r'^accounts/login/$', the_login_view),
76     (r'^login/?$', the_login_view),
77     (r'^logout/?$', 'auth.views.logout_user'),
78     #
79     # the manifold proxy
80     (r'^manifold/proxy/(?P<format>\w+)/?$', 'manifoldapi.manifoldproxy.proxy'),
81     #
82     #
83     # RESTful interface
84     (r'^rest/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
85     (r'^sfa/(?P<method>[^/]+)/?$', 'rest.sfa_api.dispatch'),
86     (r'^table/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
87     (r'^datatable/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.get.dispatch'),
88     (r'^update/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.update.dispatch'),
89     (r'^create/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.create.dispatch'),
90     (r'^delete/(?P<object_type>[^/]+)/(?P<object_name>[^/]+)?/?$', 'rest.delete.dispatch'),
91     (r'^credentials/(?P<action>[^/]+)/?$', 'rest.credentials.dispatch'),
92     #
93     # REST monitoring
94     (r'^monitor/services/?$', 'rest.monitor.servicesStatus'),
95     #
96     #(r'^view/?', include('view.urls')),
97     #(r'^list/slices', 'view.list.slices')
98     #
99     #
100     # Portal
101     (r'^news/?$', portal.newsview.NewsView.as_view()),
102     (r'^resources/(?P<slicename>[^/]+)/?$', portal.sliceresourceview.SliceResourceView.as_view()),
103     (r'^users/(?P<slicename>[^/]+)/?$', portal.slicetabusers.SliceUserView.as_view()),
104     
105     (r'^slice/(?P<slicename>[^/]+)/?$', portal.sliceview.SliceView.as_view()),
106     (r'^info/(?P<slicename>[^/]+)/?$', portal.slicetabinfo.SliceInfoView.as_view()),
107     (r'^testbeds/(?P<slicename>[^/]+)/?$', portal.slicetabtestbeds.SliceTabTestbeds.as_view()),
108     (r'^measurements/(?P<slicename>[^/]+)/?$', portal.slicetabmeasurements.SliceTabMeasurements.as_view()),
109     (r'^experiment/(?P<slicename>[^/]+)/?$', portal.slicetabexperiment.ExperimentView.as_view()),
110     
111     url(r'^about/?$', AboutView.as_view(), name='about'),
112     
113     url(r'^institution/?$', InstitutionView.as_view(), name='institution'),
114     (r'^management/requests/?$', portal.managementtabrequests.ManagementRequestsView.as_view()),
115     (r'^management/about/?$', portal.managementtababout.ManagementAboutView.as_view()),
116     #
117     url(r'^register/?$', RegistrationView.as_view(), name='registration'),
118     url(r'^account/?$', AccountView.as_view(), name='account'),
119     url(r'^account/account_process/?$', account_process),
120     url(r'^contact/?$', ContactView.as_view(), name='contact'),
121     url(r'^terms/?$', TermsView.as_view(), name='terms'),
122     url(r'^support/?$', SupportView.as_view(), name='support'),
123     #
124     url(r'^portal/', include('portal.urls')),
125
126     # SLA
127     url(r'^sla/', include('sla.urls')),
128 ]
129
130 #this one would not match the convention
131 # url(r'^debug/', include('debug_platform.urls')),
132 # but it was commented out anyways
133 for aux in auxiliaries:
134     if aux in INSTALLED_APPS:
135         urls.append ( url ( r'^%s/'%aux, include ('%s.urls'%aux )))
136
137 urlpatterns = patterns(*urls)