showard | f828c77 | 2010-01-25 21:49:42 +0000 | [diff] [blame] | 1 | import os |
Aviv Keshet | 0a0029f | 2017-04-17 12:51:39 -0700 | [diff] [blame] | 2 | from django.conf import urls |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 3 | from django.conf import settings |
| 4 | |
showard | a5288b4 | 2009-07-28 20:06:08 +0000 | [diff] [blame] | 5 | # The next two lines enable the admin and load each admin.py file: |
| 6 | from django.contrib import admin |
| 7 | admin.autodiscover() |
| 8 | |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 9 | RE_PREFIX = '^' + settings.URL_PREFIX |
showard | 250d84d | 2010-01-12 21:59:48 +0000 | [diff] [blame] | 10 | TKO_RE_PREFIX = '^' + settings.TKO_URL_PREFIX |
mbligh | e8819cd | 2008-02-15 16:48:40 +0000 | [diff] [blame] | 11 | |
showard | f828c77 | 2010-01-25 21:49:42 +0000 | [diff] [blame] | 12 | handler404 = 'django.views.defaults.page_not_found' |
showard | 37c7fe6 | 2008-07-24 16:35:02 +0000 | [diff] [blame] | 13 | handler500 = 'frontend.afe.views.handler500' |
| 14 | |
Aviv Keshet | 0a0029f | 2017-04-17 12:51:39 -0700 | [diff] [blame] | 15 | urlpatterns = urls.patterns( |
showard | f713072 | 2009-12-23 00:06:16 +0000 | [diff] [blame] | 16 | '', |
Aviv Keshet | 0a0029f | 2017-04-17 12:51:39 -0700 | [diff] [blame] | 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')), |
showard | a5288b4 | 2009-07-28 20:06:08 +0000 | [diff] [blame] | 20 | ) |
showard | ff72fe3 | 2008-10-07 11:06:17 +0000 | [diff] [blame] | 21 | |
showard | 2edbd92 | 2010-01-20 01:11:01 +0000 | [diff] [blame] | 22 | if os.path.exists(os.path.join(os.path.dirname(__file__), |
| 23 | 'tko', 'site_urls.py')): |
Aviv Keshet | 0a0029f | 2017-04-17 12:51:39 -0700 | [diff] [blame] | 24 | urlpatterns += urls.patterns( |
| 25 | '', (TKO_RE_PREFIX, urls.include('frontend.tko.site_urls'))) |
showard | 2edbd92 | 2010-01-20 01:11:01 +0000 | [diff] [blame] | 26 | |
Aviv Keshet | 0a0029f | 2017-04-17 12:51:39 -0700 | [diff] [blame] | 27 | debug_patterns = urls.patterns( |
showard | f713072 | 2009-12-23 00:06:16 +0000 | [diff] [blame] | 28 | '', |
showard | a5288b4 | 2009-07-28 20:06:08 +0000 | [diff] [blame] | 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 | ) |
showard | ff72fe3 | 2008-10-07 11:06:17 +0000 | [diff] [blame] | 34 | |
| 35 | if settings.DEBUG: |
showard | f713072 | 2009-12-23 00:06:16 +0000 | [diff] [blame] | 36 | urlpatterns += debug_patterns |