with this change, no need to tweak settings.py or urls.py any more
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 11:17:53 +0000 (12:17 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 11:18:16 +0000 (12:18 +0100)
INSTALLED_APPS and urls will be defined for our 3 auxiliaries
sandbox sample and trash
based on whether the dir. is found or not under ROOT

myslice/settings.py
myslice/urls.py

index 33588d4..b7b7b2c 100644 (file)
@@ -34,6 +34,13 @@ if not os.path.isdir (os.path.join(HTTPROOT,"static")):
 if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for unfold"%ROOT
 if not os.path.isdir(HTTPROOT): raise Exception,"Cannot find HTTPROOT %s for unfold"%HTTPROOT
 
+# dec 2013 - we currently have 3 auxiliary subdirs with various utilities
+# that we do not wish to package 
+# hopefully the number should go down to 1
+# for each of these, if we find a directory of that name under ROOT, it then gets
+# inserted in INSTALLED_APPS and its urls get included (see urls.py)
+auxiliaries = [ 'sandbox', 'sample', 'trash', ]
+
 ####################
 ADMINS = (
     # ('your_name', 'your_email@test.com'),
@@ -169,7 +176,7 @@ TEMPLATE_DIRS = (
     os.path.join(HTTPROOT,"templates"),
 )
 
-INSTALLED_APPS = (
+INSTALLED_APPS = [
     'django.contrib.auth',
     'django.contrib.contenttypes',
     'django.contrib.sessions',
@@ -194,18 +201,11 @@ INSTALLED_APPS = (
     # Uncomment the next line to enable admin documentation:
     # 'django.contrib.admindocs',
     'portal',
-    # temporary - not packaged
-    'trash',
-    'sample',
-    'sandbox'
-# DEPRECATED #    'django.contrib.formtools',
-# DEPRECATED ##    'crispy_forms',
-# DEPRECATED #
-# DEPRECATED #    # User registration
-# DEPRECATED #    'django.contrib.auth',
-# DEPRECATED #    'django.contrib.sites',
-# DEPRECATED #    'registration',
-)
+]
+for aux in auxiliaries:
+    if os.path.isdir(os.path.join(ROOT,aux)): 
+        print "Using devel auxiliary",aux
+        INSTALLED_APPS.append(aux)
 
 ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value.
 
index b204797..6419726 100644 (file)
@@ -9,6 +9,8 @@ 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
@@ -28,7 +30,7 @@ the_after_login_view=dashboard_view
 # might need another one ?
 the_login_view=home_view
 
-urlpatterns = patterns(
+urls = [
     '',
     # Examples:
     # url(r'^$', 'myslice.views.home', name='home'),
@@ -39,31 +41,28 @@ urlpatterns = patterns(
     # url(r'^admin/', include(admin.site.urls)),
     #
     # default / view
-    #
     (r'^/?$', the_default_view),
     #
     # login / logout
-    #
     (r'^login-ok/?$', the_after_login_view, {'state': 'Welcome to MySlice'} ),
+    #
     # seems to be what login_required uses to redirect ...
     (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'),
     #
     # Portal
     url(r'^portal/', include('portal.urls')),
-    # Sandbox
-    url(r'^sandbox/', include('sandbox.urls')),
-    url(r'^sample/', include('sample.urls')),
-    # Debug
-#    url(r'^debug/', include('debug_platform.urls')),
-    #
-    # various trash views - bound to go away 
-    #
-#    url(r'^trash/', include('trash.urls')),
+]
+
+#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)