I am running my django project from subfolder of a website. Lets say the address where my project is meant to open from is.
http://example.com/myproject/
the myproject folder is root folder for my user account. In that folder i have fcgi script that starts my project. The .htaccess file in the folder contains this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ mysite.fcgi/$1 [QSA,L]
The trouble is, that at some cases, instead of redireting user to page like
http://example.com/myproject/social/someurl/
it redirects to
http://example.com/social/someurl/
which does not work. What i want to know is how to fix this problem.
Redirects in django-socialauth (github.com/uswaretech/Django-Socialauth), socialauth.views.py line 177 redirects without /myproject/, similar to the generic example above. I also use django cms2.0 in the project and it redirects user at admin auth to example.com/en/myproject/admin/, not example.com/myproject/en/admin. But that could be django cms’s problem.
Is this kind of behaviour django problem and i should change it with urconf and add myproject to all urls, or should i do this with .htaccess? I found similar question, which, sadly, remains unanswered:
How to write .htaccess if django project is in subfolder and subdomain?
Alan.
It’s seems that django-cms-2.0 add the locale prefix to the url using the middleware level. Very well indeed.
But what’s more interesting is that they prefix all of the url using resolve(‘pages-root’)
So, you might be able to do this in the urls.py instead…
Just make sure that you append the above urlpatterns before the cms.urls.