[ff623c3] | 1 | from django.conf.urls import patterns, include, url |
---|
[0f53aae] | 2 | from django.contrib.auth.views import login, logout |
---|
[719e4bb] | 3 | |
---|
[cafab4c] | 4 | import settings |
---|
| 5 | |
---|
[f468e6d] | 6 | # Necessary views |
---|
[7c3ea05] | 7 | import finance_core.views |
---|
[21360c8] | 8 | from util.shortcuts import TemplateViewWithContext |
---|
[f468e6d] | 9 | |
---|
[719e4bb] | 10 | # Uncomment the next two lines to enable the admin: |
---|
[13a23ce] | 11 | from django.contrib import admin |
---|
| 12 | admin.autodiscover() |
---|
[719e4bb] | 13 | |
---|
| 14 | urlpatterns = patterns('', |
---|
| 15 | # Example: |
---|
[21360c8] | 16 | url(r'^$', TemplateViewWithContext.as_view(template_name='index.html', extra_context={ 'pagename':'homepage' }), name='homepage'), |
---|
[7c3ea05] | 17 | (r'^vouchers/', include('vouchers.urls')), |
---|
| 18 | (r'^finance_core/', include('finance_core.urls')), |
---|
[719e4bb] | 19 | |
---|
| 20 | # Uncomment the admin/doc line below and add 'django.contrib.admindocs' |
---|
| 21 | # to INSTALLED_APPS to enable admin documentation: |
---|
[13a23ce] | 22 | (r'^admin/doc/', include('django.contrib.admindocs.urls')), |
---|
[719e4bb] | 23 | |
---|
| 24 | # Uncomment the next line to enable the admin: |
---|
[0671644] | 25 | (r'^admin/', include(admin.site.urls)), |
---|
[0f53aae] | 26 | url(r'^accounts/login/', login, name='login', ), |
---|
| 27 | url(r'^accounts/logout/', logout, name='logout', ), |
---|
[719e4bb] | 28 | ) |
---|
[cafab4c] | 29 | |
---|
| 30 | if settings.DEBUG: |
---|
[f5bebab] | 31 | print "In debug mode; enabling static media serving" |
---|
[cafab4c] | 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) |
---|