一、下载httpd-2.2.16-win32-x86-no_ssl.msi 安装
注意如果开启了iis记得停止
二、下载mod_wsgi-win32-ap22py26-3.3.so
下载地址:http://code.google/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py26-3.3.so
三、修改mod_wsgi-win32-ap22py26-3.3.so 为mod_wsgi.so 并拷贝到C:/Program Files/Apache Software Foundation/Apache2.2/modules (具体目录就是你安装apache的目录)
四、修改httpd.conf(一般在c:/Program Files/Apache Software Foundation/Apache2.2/conf)添加如下内容:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / "D:/Django/django/bin/blogmysite/django.wsgi"
<Directory "D:/Django/django/bin/blogmysite">
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
说明:我的django安装在d:/django/django下
新建的proejct 叫blogmysite
新建的app叫blog
五、在工程目录下新建wsgi文件(我的是:D:/Django/django/bin/blogmysite/),内容:
import os
import sys
import django.core.handlers.wsgi
sys.path.append('D:/Django/django/bin')
sys.path.append('D:/Django/django/bin/blogmysite')
sys.path.append('D:/Django/django/bin/blogmysite/blog')
os.environ['DJANGO_SETTINGS_MODULE'] = 'blogmysite.settings'
application = django.core.handlers.wsgi.WSGIHandler()
六、浏览,打入http://localhost/blog 显示正常
如果出错可以查看c:/Program Files/Apache Software Foundation/Apache2.2/logs/error.log
如果出现如下错误:
ImportError: No module named XXX.models
或者
[Tue Aug 17 23:11:22 2010] [error] [client 127.0.0.1] ImportError: Could not import settings 'XXX.settings' (Is it on sys.path? Does it have syntax errors?): No module named XXX.settings
你可以在django.wsgi 里面加入相关的程序目录(sys.path.append('你的目录'),注意不要用/结尾)
一、下载httpd-2.2.16-win32-x86-no_ssl.msi 安装
注意如果开启了iis记得停止
二、下载mod_wsgi-win32-ap22py26-3.3.so
下载地址:http://code.google/p/modwsgi/downloads/detail?name=mod_wsgi-win32-ap22py26-3.3.so
三、修改mod_wsgi-win32-ap22py26-3.3.so 为mod_wsgi.so 并拷贝到C:/Program Files/Apache Software Foundation/Apache2.2/modules (具体目录就是你安装apache的目录)
四、修改httpd.conf(一般在c:/Program Files/Apache Software Foundation/Apache2.2/conf)添加如下内容:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / "D:/Django/django/bin/blogmysite/django.wsgi"
<Directory "D:/Django/django/bin/blogmysite">
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
说明:我的django安装在d:/django/django下
新建的proejct 叫blogmysite
新建的app叫blog
五、在工程目录下新建wsgi文件(我的是:D:/Django/django/bin/blogmysite/),内容:
import os
import sys
import django.core.handlers.wsgi
sys.path.append('D:/Django/django/bin')
sys.path.append('D:/Django/django/bin/blogmysite')
sys.path.append('D:/Django/django/bin/blogmysite/blog')
os.environ['DJANGO_SETTINGS_MODULE'] = 'blogmysite.settings'
application = django.core.handlers.wsgi.WSGIHandler()
六、浏览,打入http://localhost/blog 显示正常
如果出错可以查看c:/Program Files/Apache Software Foundation/Apache2.2/logs/error.log
如果出现如下错误:
ImportError: No module named XXX.models
或者
[Tue Aug 17 23:11:22 2010] [error] [client 127.0.0.1] ImportError: Could not import settings 'XXX.settings' (Is it on sys.path? Does it have syntax errors?): No module named XXX.settings
你可以在django.wsgi 里面加入相关的程序目录(sys.path.append('你的目录'),注意不要用/结尾)