1 | from django.conf.urls import patterns, include, url |
---|
2 | from django.contrib.auth.views import login, logout |
---|
3 | |
---|
4 | import settings |
---|
5 | |
---|
6 | # Necessary views |
---|
7 | import finance_core.views |
---|
8 | from util.shortcuts import TemplateViewWithContext |
---|
9 | |
---|
10 | # Uncomment the next two lines to enable the admin: |
---|
11 | from django.contrib import admin |
---|
12 | admin.autodiscover() |
---|
13 | |
---|
14 | urlpatterns = patterns('', |
---|
15 | # Example: |
---|
16 | url(r'^$', TemplateViewWithContext.as_view(template_name='index.html', extra_context={ 'pagename':'homepage' }), name='homepage'), |
---|
17 | (r'^vouchers/', include('vouchers.urls')), |
---|
18 | (r'^finance_core/', include('finance_core.urls')), |
---|
19 | |
---|
20 | # Uncomment the admin/doc line below and add 'django.contrib.admindocs' |
---|
21 | # to INSTALLED_APPS to enable admin documentation: |
---|
22 | (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
---|
23 | |
---|
24 | # Uncomment the next line to enable the admin: |
---|
25 | (r'^admin/', include(admin.site.urls)), |
---|
26 | url(r'^accounts/login/', login, name='login', ), |
---|
27 | url(r'^accounts/logout/', logout, name='logout', ), |
---|
28 | ) |
---|
29 | |
---|
30 | if settings.DEBUG: |
---|
31 | print "In debug mode; enabling static media serving" |
---|
32 | from django.views.static import serve |
---|
33 | _media_url = settings.MEDIA_URL |
---|
34 | if _media_url.startswith('/'): |
---|
35 | _media_url = _media_url[1:] |
---|
36 | urlpatterns += patterns('', |
---|
37 | (r'^%s(?P<path>.*)$' % _media_url, |
---|
38 | serve, |
---|
39 | {'document_root': settings.MEDIA_ROOT})) |
---|
40 | del(_media_url, serve) |
---|