Config -> ConfigEngine
[myslice.git] / myslice / urls.py
index ef1f30c..5e1547b 100644 (file)
@@ -1,5 +1,6 @@
 from django.conf.urls import patterns, include, url
 from django.conf      import settings
+from django.contrib import admin
 
 # Uncomment the next two lines to enable the admin:
 # from django.contrib import admin
@@ -9,12 +10,28 @@ from django.conf      import settings
 from django.template.loader import add_to_builtins
 add_to_builtins('insert_above.templatetags.insert_tags')
 
+from settings import auxiliaries, INSTALLED_APPS
+
+import portal.platformsview
+import portal.dashboardview
+import portal.homeview
+
+home_view=portal.homeview.HomeView.as_view()
+dashboard_view=portal.dashboardview.DashboardView.as_view()
+platforms_view=portal.platformsview.PlatformsView.as_view()
+
+#### high level choices
 # main entry point (set to the / URL)
-default_view='trash.pluginview.test_plugin_view'
+# beware that if this view is broken you end up in an endless cycle...
+# maybe platforms_view would be best on the longer run
+the_default_view=home_view
 # where to be redirected after login
-after_login_view='trash.dashboard.dashboard_view'
-
-urlpatterns = patterns(
+the_after_login_view=dashboard_view
+# where to redirect when login is required
+# might need another one ?
+the_login_view=home_view
+admin.autodiscover()
+urls = [
     '',
     # Examples:
     # url(r'^$', 'myslice.views.home', name='home'),
@@ -22,40 +39,31 @@ urlpatterns = patterns(
     # Uncomment the admin/doc line below to enable admin documentation:
     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
     # Uncomment the next line to enable the admin:
-    # url(r'^admin/', include(admin.site.urls)),
+     url(r'^admin/', include(admin.site.urls)),
     #
     # default / view
-    #
-    (r'^/?$', default_view),
+    (r'^/?$', the_default_view),
     #
     # login / logout
+    (r'^login-ok/?$', the_after_login_view, {'state': 'Welcome to MySlice'} ),
     #
-    (r'^login-ok/?$', after_login_view),
     # seems to be what login_required uses to redirect ...
-    (r'^accounts/login/$', 'auth.views.login_user'),
-    (r'^login/?$', 'auth.views.login_user'),
+    (r'^accounts/login/$', the_login_view),
+    (r'^login/?$', the_login_view),
     (r'^logout/?$', 'auth.views.logout_user'),
     #
     # the manifold proxy
-    #
     (r'^manifold/proxy/(?P<format>\w+)/?$', 'manifold.manifoldproxy.proxy'),
     #
-    # various trash views
-    #
-    (r'^tab/?$', 'trash.sampleviews.tab_view'),
-    (r'^scroll/?$', 'trash.sampleviews.scroll_view'),
-    (r'^plugin/?$', 'trash.pluginview.test_plugin_view'),
-    (r'^dashboard/?$', 'trash.dashboard.dashboard_view'),
-    (r'^slice/?$', 'trash.sliceview.slice_view'),
-    (r'^slice/(?P<slicename>[\w\.]+)/?$', 'trash.sliceview.slice_view'),
     # Portal
     url(r'^portal/', include('portal.urls')),
-    # Portal
-    url(r'^sample/', include('sample.urls')),
-    # Debug
-    url(r'^debug/', include('debug_platform.urls')),
-    # Static files
-    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
+]
 
+#this one would not match the convention
+# url(r'^debug/', include('debug_platform.urls')),
+# but it was commented out anyways
+for aux in auxiliaries:
+    if aux in INSTALLED_APPS:
+        urls.append ( url ( r'^%s/'%aux, include ('%s.urls'%aux )))
 
-)
+urlpatterns = patterns(*urls)