from django.conf import settings from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'', include('commons.urls')), (r'^', include('eol.urls')), ) # Handle 404 and 500 errors handler404 = 'commons.views.handle404' handler500 = 'commons.views.handle500' ## In DEBUG mode, serve media files through Django. if settings.DEBUG: # Remove leading and trailing slashes so the regex matches. media_url = settings.MEDIA_URL.lstrip('/').rstrip('/') urlpatterns += patterns('', (r'^%s/(?P.*)$' % media_url, 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )