我知道这可能是一个经常被问到的问题,但是我在近一天的时间内尽力推出我的第一个django网站而没有任何结果,所以请任何有共享主机和django经验的人帮忙。这是任何相关信息: 在$ HOME / .local / lib /远程机器上安装python 2.6 flup和django在同一个地方,都是由setup.py install --user完成的。 我的django项目文件结构:
$HOME/
projects/django/bw_python/
manage.py
bw_python/
__init__.py
settings.py
urls.py
wsgi.py
site_main/
django app with urls,models, etc...
在$ HOME / .bashrc中,我有以下几行:
export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH
export PYTHONPATH=$HOME/projects/django:$HOME/projects/django/bw_python:$HOME/projects/django/bw_python/bw_python:$HOME/projects/django/bw_python/site_main:$PYTHONPATH
如果我运行python interpreter django并且flup正在运行,那么manage.py runserver可以正常运行。
现在在public_html中我有以下bw_python.fcgi脚本:
#!/usr/bin/env python
import sys, os
# Add a custom Python path.
sys.path.insert(0, "/home5/bwinnova/.local/lib/python")
# Switch to the directory of your project. (Optional.)
os.chdir("/home5/bwinnova/projects/django/bw_python")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "bw_python.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
如果我执行./bw_python.fcgi,我得到:
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 301 MOVED PERMANENTLY
Content-Type: text/html; charset=utf-8
Location: http://localhost/home/
.htaccess:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_URI} !-f
RewriteRule ^(.*)$ bw_python.fcgi/$1 [QSA,L]
这两个文件上的chmod包括$ HOME / projects / django / bw_python是755。 对不起,但是从教程我被困在这里?下一步要做什么?我总是得到500服务器错误,并在服务器错误日志上只有这个:
[Fri Jul 27 19:29:14 2012] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored.
提前感谢您提供任何帮助或指导。