Source

django-in-a-box / project / urls.py

Full commit
# -*- coding: utf-8 -*-

from django.conf import settings
from django.conf.urls.defaults import *


urlpatterns = patterns('',
    ## Nothing here yet.
)


if 'django.contrib.admin' in settings.INSTALLED_APPS:
    from django.contrib import admin
    admin.autodiscover()
    
    # Ensure admin comes first.
    urlpatterns = patterns('',
        url(r'^admin/', include(admin.site.urls), name='admin-root')
    ) + urlpatterns


# If we’re in a production environment, these paths will get handled by the
# web server anyway.
urlpatterns += patterns('',
    url(r'^media/admin/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.ADMIN_MEDIA_ROOT}),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT}),
)