Login

Url overrides and concurrent site versions

Author:
henrikv
Posted:
March 8, 2007
Language:
Python
Version:
Pre .96
Tags:
urlconf staging
Score:
0 (after 0 ratings)

If you want to run multiple versions of a site from the same project IE a staging version and the live one, you need two settings and urlconf files.

  1. make separate copies of settings_staging.py and urls_staging.py in the project dir.
  2. Change SITE_ID and ROOT_URLCONF in settings_staging.py
  3. Make extra include lines in the projects urls_staging.py like the example.
  4. Add urls_staging.py to applications where you need extra urls. Make them just like you would normally do urls.py

Thanks to ronny for suggesting the double entries in urlconf.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# in the project urls_staging.py
urlpatterns = patterns('',
    (r'^about/', include('live.about.urls_staging')),
    (r'^about/', include('live.about.urls')),
    (r'^places/', include('live.place.urls.places_staging')),
    (r'^places/', include('live.place.urls.places')),
    (r'^comments/', include('live.place.urls.comments_staging')),
    (r'^comments/', include('live.place.urls.comments')),

    (r'^users/', include('live.users.urls_staging')),
    (r'^users/', include('live.users.urls')),

    (r'^admin/', include('django.contrib.admin.urls')),
)

# in the app urls_staging.py
from django.conf.urls.defaults import *
urlpatterns = patterns('live.users.views.account',
    (r'^account$', 'my_account'),
    (r'^account/friends$', 'friends'),
)

More like this

  1. Mobilize your Django site by stevena0 6 years, 3 months ago
  2. FieldsetForm by Ciantic 8 years, 3 months ago
  3. Run Django as a FastCGI authorizer by cme 6 years, 9 months ago
  4. Simple Plone Migration by msm-art 7 years, 6 months ago
  5. SSL Middleware for Webfaction by parlar 8 years, 2 months ago

Comments

Please login first before commenting.