fix urls
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 30 Nov 2012 14:12:22 +0000 (15:12 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 30 Nov 2012 14:12:22 +0000 (15:12 +0100)
project_name/urls.py

index aec0289..4471526 100644 (file)
@@ -1,21 +1,26 @@
 from django.conf.urls import patterns, include, url
+from django.conf import settings
 
-from django.contrib import admin
-admin.autodiscover()
-
-urlpatterns = patterns('',
-    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
-    url(r'^admin/', include(admin.site.urls)),
+urlpatterns += patterns('',
+    # Examples:
+    # url(r'^$', '{{ project_name }}.views.home', name='home'),
+    # url(r'^{{ project_name }}/', include('foo.urls')),
 )
 
+
+# Admin stuff, if necessary.
+if 'django.contrib.admin' in settings.INSTALLED_APPS:
+    from django.contrib import admin
+    admin.autodiscover()
+
+    urlpatterns += patterns('',
+        url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
+        url(r'^admin/', include(admin.site.urls)),
+    )
+
+# Auth stuff, if necessary
 if 'django_cas' in settings.INSTALLED_APPS:
     urlpatterns += patterns('',
         (r'^accounts/login/$', 'django_cas.views.login'),
         (r'^accounts/logout/$', 'django_cas.views.logout'),
     )
-
-urlpatterns += patterns('',
-    # Examples:
-    # url(r'^$', '{{ project_name }}.views.home', name='home'),
-    # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),
-)