1 import os 2 from django.conf import urls 3 from django.conf import settings 4 5 # The next two lines enable the admin and load each admin.py file: 6 from django.contrib import admin 7 admin.autodiscover() 8 9 RE_PREFIX = '^' + settings.URL_PREFIX 10 TKO_RE_PREFIX = '^' + settings.TKO_URL_PREFIX 11 12 handler404 = 'django.views.defaults.page_not_found' 13 handler500 = 'frontend.afe.views.handler500' 14 15 urlpatterns = urls.patterns( 16 '', 17 (RE_PREFIX + r'admin/', urls.include(admin.site.urls)), 18 (RE_PREFIX, urls.include('frontend.afe.urls')), 19 (TKO_RE_PREFIX, urls.include('frontend.tko.urls')), 20 ) 21 22 if os.path.exists(os.path.join(os.path.dirname(__file__), 23 'tko', 'site_urls.py')): 24 urlpatterns += urls.patterns( 25 '', (TKO_RE_PREFIX, urls.include('frontend.tko.site_urls'))) 26 27 debug_patterns = urls.patterns( 28 '', 29 # redirect /tko and /results to local apache server 30 (r'^(?P<path>(tko|results)/.*)$', 31 'frontend.afe.views.redirect_with_extra_data', 32 {'url': 'http://%(server_name)s/%(path)s?%(getdata)s'}), 33 ) 34 35 if settings.DEBUG: 36 urlpatterns += debug_patterns 37