> could change!)? However, at the same time I want to be able to run the > development environment at http://127.0.0.1/ and want any maintenance > overhead e.g. managing two sets of url.py files or changing any urls
expanding on Stefan's solution: You probably want a separate settings.py or at least a settings.py file that is 'production' vs 'non-production' aware. I suggest using hostname. You wouldn't want to blast the production database from your development machine! Unfortunately, I don't think there is a way to avoid (initially) updating every URL (not just urls.py), but also any references in templates, views, get_absolute_url(), etc. Just a thought, it is possible to deloy on a separate machine? That should pretty much eliminate Django URL related issues and might be more economical. The toil and trouble trade off might be worth it. On Nov 11, 10:09 pm, "Stefan Matthias Aust" <[EMAIL PROTECTED]> wrote: > On Nov 11, 2007 1:44 PM, RichardH <[EMAIL PROTECTED]> wrote: > > > From researching posts and blogs, I know this is a difficult issue but > > was wondering whether anyone has come up with simple solutions? > > I had a similar problem. My solution was to setup a context processor > which adds a "root" variable to all contexts and then using that > variable as in <a href="{{root}}/relative/">...</a> in all templates. > > Such a processor is easy to create, for example: > > def add_root_url(request): > from django.conf import settings > return dict(root=('' if settings.DEBUG else settings.DEPLOYMENT_ROOT)) > > You need to add the function name to the settings' > TEMPLATE_CONTEXT_PROCESSORS tuple. > > HTH, > > -- > Stefan Matthias Aust --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---