- March 8, 2007
- Pre .96
- staging urlconf
- 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.
- make separate copies of settings_staging.py and urls_staging.py in the project dir.
- Change SITE_ID and ROOT_URLCONF in settings_staging.py
- Make extra include lines in the projects urls_staging.py like the example.
- 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'), )