Reputation: 3575
I've been trying to deploy a simple Django website on my own Ubuntu server. After some troubles I've finally gotten most of it to work, except some issues with URLs and the admin site.
All parts of the site designed by myself works fine, but there's an issue with the admin site. (which works fine locally with runserver btw). I have a link to "/admin/" on my own site which works, and sends me to the login for the admin site. When clicking "log in" however, i get a 404 error and: Request URL: http://mydomain.com/homepage.fcgi/homepage.fcgi/admin/
Obviously there is something wrong with the url-rewrite. With all other links it adds "homepage.fcgi" invisibly once, but here it does it twice. I bet there's a simple solution, but this is my first time ever deploying anything other than a pure html site..
Here is the end of my lighttpd.conf:
fastcgi.server = (
"/homepage.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
# "host" => "127.0.0.1",
# "port" => 3033,
"socket" => "/home/myDjango/fcgi/homepage.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/static" => "/home/myDjango/static_root",
)
url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/.*)$" => "/homepage.fcgi$1",
)
Upvotes: 0
Views: 149
Reputation: 3575
Answering my own question here.
Add FORCE_SCRIPT_NAME = "" to settings.py. Then restart the fcgi process.
I knew about the FORCE_SCRIPT_NAME = "" trick before posting this, but i thought it didn't work because i didn't restart fcgi.
Upvotes: 1