Created
October 31, 2011 08:07
-
-
Save mbrochh/1327107 to your computer and use it in GitHub Desktop.
urls.py for django-cms / staticfiles / DEBUG=False compatible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf import settings | |
| from django.conf.urls.defaults import * | |
| from django.conf.urls.static import static | |
| from django.contrib.staticfiles.urls import staticfiles_urlpatterns | |
| # The next two lines enable the admin and load each admin.py file: | |
| from django.contrib import admin | |
| admin.autodiscover() | |
| urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | |
| urlpatterns += staticfiles_urlpatterns() | |
| if settings.DEBUG is False and settings.SANDBOX is True: | |
| urlpatterns += patterns('', | |
| url(r'^static/(?P<path>.*)$', 'django.views.static.serve', | |
| {'document_root': settings.STATIC_ROOT}), | |
| url(r'^media/(?P<path>.*)$', 'django.views.static.serve', | |
| {'document_root': settings.MEDIA_ROOT}), | |
| ) | |
| urlpatterns += patterns( | |
| '', | |
| url(r'^', include('cms.urls')), | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment