Something on our host was driving me crazy for hours yesterday.  

after deploying to mysite.com/directory, when I followed a link (say about-us) it would take me to mysite.com/about-us instead of mysite.com/directory/about-us.

I thought it might be related to the Site settings and even tried the shell:

 >>> from django.contrib.sites.models import Site
 >>> Site.objects.get_current().domain 


but that returned mysite.com/directory.

Fortunately support at webfaction is pretty quick and smart and they pointed us to a variable in the settings file.  If you’re having that same problem just add:

#settings.py
FORCE_SCRIPT_NAME = "/directory"

(with no forward slash)

blog comments powered by Disqus