Hi all

Like other posts on this group I am trying to work out the best approach for an 
app 
that has a development version at / and a production version at /proteomics/pls/

My templates contain href="/detail/{{ some_variable }}" which works in test but 
I 
dont want to have to change them all to
href="/proteomics/pls/detail/{{ some_variable }}" when I copy updates to 
prooduction.
I'm using in urls.py
   (r'^detail'/  , lab.views.detail)

One solution is to have this:
1. In settings.py a variable URL_ROOT = '/' for testing and
    URL_ROOT = '/proteomics/pls' for production
2. In views.py I have 'from django.conf import settings'
3. and for each template use
    href="{{ settings.URL_ROOT }}/detail/{{ some_variable }}"

But I don't think importing settings when I just need one URL is the way to do 
things 
correctly and also the Django docs say "Also note that your code should not 
import 
from either global_settings or your own settings file." in 
http://www.djangoproject.com/documentation/settings/

So my question is if some consensus has developed or is there a 'proper' method 
for 
dealing with this?

Notes: A search of this mailing group using the text "url root" shows the 
following 
relevant posts:

global settings
http://groups.google.com/group/django-users/browse_thread/thread/e3416f06e13e87c3/053f939b4f5cdaca?lnk=gst&q=url+root&rnum=2&hl=en#053f939b4f5cdaca

Root URI in templates
http://groups.google.com/group/django-users/browse_thread/thread/3346f3f509bf3bf8/c8595511c8d34c05?lnk=gst&q=url+root&rnum=4&hl=en#
        
Project URL-prefix
http://groups.google.com/group/django-users/browse_thread/thread/f16d6bcf4d667069/d0c58efec5640d61?lnk=gst&q=url+root&rnum=8&hl=en#

Mike
-- 
Michael Lake




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to