Hi, Yes as per my first and second replies and the SO link I have done it with and without quotes.
To be clear - this is not a 'fix my code' question as I had already found the workaround before posting, the question is more whether it is expected behaviour for the {% url %} tag to act differently in and out of a virtualenv... Thanks, Will On Saturday, September 8, 2012 1:12:31 AM UTC+1, ke1g wrote: > > Have you tried it without the quotes? None of the examples in the > docs (https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#url) > use quotes. (Which, in turn, probably means that you can't use a > variable there.) > > On Fri, Sep 7, 2012 at 7:46 PM, William Hart <har...@gmail.com<javascript:>> > wrote: > > Hi, > > Thanks for the reply. > > > > Yes I'm fairly certain their are no absolute paths - the settings paths > are > > all built up using os.path, and there are no paths elsewhere in the > > document. > > > > Basically as far as I can tell what is happening is that the url name > for > > > > {% url 'dashboard' %} > > > > is interpreted as dashboard outside of a virtual environment and is > working > > ok, but is interpreted as 'dashboard' (with single quotes) inside a > virtual > > environment. I'm curious I suppose as to whether this is expected > behaviour > > or a bug. > > > > Thanks, > > Will > > > > > > > > On Friday, September 7, 2012 11:00:46 PM UTC+1, ke1g wrote: > >> > >> Are you certain that you don't have an absolute path lurking somewhere > >> in your code? > >> > >> On Fri, Sep 7, 2012 at 3:36 PM, William Hart <har...@gmail.com> wrote: > >> > Hi all, > >> > I've made a post on stack overflow, but I'm not sure if this is some > >> > kind of > >> > weird bug or just something silly I'm doing. (see > >> > > >> > > http://stackoverflow.com/questions/12310608/running-virtualenv-on-django-app-kills-my-urls). > > > >> > > >> > Basically I have an existing app with working urls set up like the > >> > following: > >> > > >> > url(r'^$', 'myapp.views.Dashboard', name="dashboard"), > >> > > >> > > >> > And used in templates like so: > >> > > >> > {% url 'dashboard' %} > >> > > >> > > >> > I pip freeze > requirements.txt, and then create and activate a > virtual > >> > environment (virtualenv venv --distribute --no-site-packges). As > soon > >> > as I > >> > activate this virtual environment I get a NoReverseMatch error for > every > >> > url > >> > in my application except admin urls. If I remove the single quotes > from > >> > the > >> > url tag above, {% url dashboard %}, it works fine so I have a work > >> > around > >> > for the problem. > >> > > >> > I have tried all the usual stuff, reinstalling virtual environments > and > >> > making sure the Django versions are the same inside and outside the > >> > virtual > >> > environment. Any thoughts? > >> > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "Django users" group. > >> > To view this discussion on the web visit > >> > https://groups.google.com/d/msg/django-users/-/RZOAigB-IhsJ. > >> > To post to this group, send email to django...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > django-users...@googlegroups.com. > >> > For more options, visit this group at > >> > http://groups.google.com/group/django-users?hl=en. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Django users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/django-users/-/Fp0oftR2Ii8J. > > > > To post to this group, send email to > > django...@googlegroups.com<javascript:>. > > > To unsubscribe from this group, send email to > > django-users...@googlegroups.com <javascript:>. > > For more options, visit this group at > > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/ZADIIEjZt4cJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.