1import os 2from django.conf.urls import defaults 3from django.conf import settings 4 5# The next two lines enable the admin and load each admin.py file: 6from django.contrib import admin 7admin.autodiscover() 8 9RE_PREFIX = '^' + settings.URL_PREFIX 10TKO_RE_PREFIX = '^' + settings.TKO_URL_PREFIX 11 12handler404 = 'django.views.defaults.page_not_found' 13handler500 = 'frontend.afe.views.handler500' 14 15urlpatterns = defaults.patterns( 16 '', 17 (RE_PREFIX + r'admin/', defaults.include(admin.site.urls)), 18 (RE_PREFIX, defaults.include('frontend.afe.urls')), 19 (TKO_RE_PREFIX, defaults.include('frontend.tko.urls')), 20 ) 21 22if os.path.exists(os.path.join(os.path.dirname(__file__), 23 'tko', 'site_urls.py')): 24 urlpatterns += defaults.patterns( 25 '', (TKO_RE_PREFIX, defaults.include('frontend.tko.site_urls'))) 26 27debug_patterns = defaults.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 35if settings.DEBUG: 36 urlpatterns += debug_patterns 37