简体   繁体   中英

Deploying site on Shared Hosting using fastcgi

I am trying to deploy the site on shared-hosting called "dreamhost" on their Debian VPS. I have followed django documentation When i visit the server ip in browser i am having following error:

The requested URL / was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

i have a project in /home/user_name/project/ i have created two files in this directory.

.htacess

AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi/$1 [QSA,L]

dispatch.fcgi

#!/usr/bin/python
import sys, os

sys.path.insert(1, '/home/user_name/project')

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "project.path.to.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

I have executed the ./dispatch.fcgi and it shows site home page in terminal. How ever nothing works when i try to access in browser, always got 404 error. hello.fcgi script also giving 404 error. I have tried all techniques but nothing is really working :(

Dreamhost has instructions for installing Django using WSGI, FastCGI, or any other method you want. Look it up on their wiki. I think the address is http://wiki.dreamhost.com/Django .
Update: (I can't add comments on my computer for some reason) Did you try mod_wsgi instead?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM