关于alwaysdata.com的Django托管错误
这是我的alwaysdata页面 - http://zjm.alwaysdata.net/:
它没有成功配置,但是当我访问 http://zjm.alwaysdata.net/mysite/public/ 时,
它显示了我的主页:
那么我该怎么做才能在 http://zjm.alwaysdata.net/ 上显示我的主页呢?
谢谢
更新
这是我的 django.fcgi
:
#!/usr/bin/python
import os, sys
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")
还有 .htaccess
:
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
这是我的 urls.py:
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
from views import *
urlpatterns = patterns('',
# Example:
#(r'^$', homepage),
# (r'^mysite/', include('mysite.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
1 个回答
1
你需要把你的域名(zjm.alwaysdata.net
)设置成指向你服务器上的 /public
目录,也就是 /home/zjm/www/mysite/public/
这个位置。