localhost:3033で基本的な「hello-world」Django Webサイト(によって作成された)に表示されるように、DjangoでLighttpdを構成したいと思います$ django-admin startproject hellodjango
。ドキュメントに従いましたが、Webサイトを機能させることができません。localhost:3033に移動した後は何も起こらず、「conncetionを待っています」というメッセージだけが表示されます。
私のlighttpd.config
server.groupname = "www-data"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
" index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl"
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" )
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
# My configuration
$HTTP["host"] == "www.hellodjango.com" {
server.document-root = "/home/krris/programowanie/django/hellodjango"
server.errorlog = "/home/krris/programowanie/django/hellodjango/logs/error.log"
accesslog.filename = "/home/krris/programowanie/django/hellodjango/logs/access.log"
fastcgi.server = (
"/hellodjango.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
"host" => "127.0.0.1",
"port" => 3033,
# "socket" => "/home/krris/hellodjango.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/media/" => "/home/krris/programowanie/django/hellodjango/media/",
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/hellodjango.fcgi$1",
)
}
hellodjango.fcgi:
#!/usr/bin/python
import sys, os
# Add a custom Python path.
sys.path.insert(0, "..")
# Switch to the directory of your project. (Optional.)
os.chdir("/home/krris/programowanie/django/hellodjango")
# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "hellodjango.settings"
from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="prefork", daemonize="true", host="127.0.0.1", port="3033")
この行もsettings.pyに追加しました:
FORCE_SCRIPT_NAME = ""
次のコマンドを使用してアプリケーションを実行します。
$ ./manage.py runfcgi method=prefork host=127.0.0.1 port=3033
エラーログ:
2013-03-19 11:27:10: (log.c.166) server started
2013-03-19 11:27:16: (server.c.1396) [note] graceful shutdown started
2013-03-19 11:27:16: (log.c.166) server started
2013-03-19 11:27:16: (server.c.1512) server stopped by UID = 0 PID = 8093
Ubuntu12.10を使用しています。