标签:密码 跳转 下载 vhost load local linux content tar
1下载xampp,里面有apache,mysql,phpmyadmin,
2 下载wsgi,http://download.csdn.net/download/copter/9192361
将对应的模块解压放到D:\programs\xampp\apache\modules
然后到D:\programs\xampp\apache\conf\httpd.conf中
# 添加mod_wsgi.so 模块
LoadModule wsgi_module modules/mod_wsgi.so
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
查看上面那行是否未注释,如注释 ,则解注释,
3 到D:\programs\xampp\apache\conf\extra\httpd-vhosts.conf中
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "D:/pyprojects/ai123"
ServerName localhost
ServerAlias localhost
WSGIScriptAlias /ai123/ D:/pyprojects/ai123/ai123/wsgi_local.py /wsgi跳转
ErrorLog "logs/vai123-error.log"
CustomLog "logs/vai123-access.log" common
<Directory "D:/pyprojects/ai123"> #添加目录权限
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
添加上面代码,
4
到 D:/pyprojects/ai123/ai123/wsgi_local.py中
import os
import sys
from django.core.wsgi import get_wsgi_application
path = ‘D:/pyprojects/ai123‘
if path not in sys.path:
sys.path.append(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ai123.settings")
#os.environ[‘PYTHON_EGG_CACHE‘] = ‘/tmp/.python-eggs‘ # mac或linux系统中可能需要
application = get_wsgi_application()
对应代码如上
5 修改mysql root密码,
set password for root@localhost=password(‘111111‘);
将mysql root用户 密码修改为和django里面settings.py里面的密码一致
6 重启 apache,访问localhost/ai123即可
如果中间访问不了,可以先在ai123下新建一个hello.wsgi文件
内容:
def application(environ, start_response):
start_response(‘200 OK‘, [(‘Content-Type‘, ‘text/html‘)])
return ‘<h1>Hello, web!</h1>‘
访问localhost/ai123应出现hello,同时测试时
WSGIScriptAlias /ai123/ D:/pyprojects/ai123/ai123/wsgi_local.py /wsgi跳转
改为
WSGIScriptAlias /ai123/ D:/pyprojects/ai123/hello.wsgi /wsgi跳转
win7 32位配置apache+wsgi+django环境
标签:密码 跳转 下载 vhost load local linux content tar
原文地址:http://www.cnblogs.com/xqnq2007/p/7450823.html