urls.py 809 Bytes
Newer Older
1 2 3
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

4
from django.conf.urls import patterns, include, url
5 6 7 8 9 10

import settings

if settings.DEBUG:
    # On n'utilise pas ça en prod
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
11

Vincent Le gallic's avatar
Vincent Le gallic committed
12 13 14
# custom 404
handler404 = "note.views.page_not_found"

15 16 17 18 19
from django.contrib import admin
admin.autodiscover()
import views

urlpatterns = patterns('',
20
    url(r'^' + settings.NOTE_ROOT_URL.strip('/'), include('note.urls')),
Vincent Le gallic's avatar
Vincent Le gallic committed
21
    url(r'^admin/', include(admin.site.urls)),
22
)
23

24 25 26 27
if settings.DEBUG:
    # On n'utilise pas ça en prod
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += patterns('',
28
        (r'^%s/(?P<path>.*)$' % (settings.MEDIA_URL.strip('/')),
29 30
         'django.views.static.serve',
         {'document_root': settings.MEDIA_ROOT}),
31
    )