Created
September 7, 2012 15:43
-
-
Save robrocker7/3667300 to your computer and use it in GitHub Desktop.
Example of URLS.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.urls.defaults import * | |
from django.conf import settings | |
from django.views.generic.simple import redirect_to | |
from django.views.decorators.cache import cache_page | |
from apps.common.views import simple_dtt | |
# Uncomment the next two lines to enable the admin: | |
from django.contrib import admin | |
admin.autodiscover() | |
# a simple direct_to_template wrapper | |
def dtt(pattern, template, name, parent=None, ctx=None): | |
ctx = ctx or {} | |
context = dict(page_name=name, parent=parent) | |
context.update(ctx) | |
return url(pattern, cache_page(60 * 60 * 4)(simple_dtt), | |
dict(template=template, extra_context=context), | |
name=name) | |
urlpatterns = patterns('', | |
# Uncomment the next line to enable the admin: | |
(r'^django-admin/', include(admin.site.urls)), | |
) | |
# Radioshack URLS | |
if settings.SITE_ID == 2: | |
urlpatterns += patterns('', | |
dtt(r'^$', 'affiliates/radioshack/_base.html', 'home', ctx={'page_name': 'index'}), | |
) | |
# Paid landing site | |
elif settings.SITE_ID == 3: | |
urlpatterns += patterns('', | |
url(r'^$', 'apps.affiliates.views.semlanding_home'), | |
) | |
elif settings.SITE_ID == 4: | |
urlpatterns += patterns('', | |
url(r'^$', 'apps.local.views.local_state', name='local-state'), | |
) | |
elif settings.SITE_ID == 5: | |
urlpatterns += patterns('', | |
dtt(r'^$', 'affiliates/site5/index.html', 'home', ctx={'page_name': 'index'}), | |
) | |
else: | |
urlpatterns += patterns('', | |
# Home Page | |
url(r'^$', 'apps.common.views.index', name='home'), | |
url(r'^thank-you/?$', 'apps.common.views.thank_you', | |
name='thank_you'), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment