Django+apache+python+mod_python的环境搭建

具体请点击:http://www.verydemo.com/demo_c122_i11689.html

1、首先确定本机已经安装的python版本,Django支持的版本为2.3-2.6,更高版本的python编译器不支持DJango的安装。在安装的时候会报错。

2、本机最早安装的版本为3.2 ,之后没办法又安装了2.5,不过python多版本可以共存,不用卸载其他的版本。

3、下载mod_python,apache注意各个程序版本的兼容性。

4、开始配置环境之前,确认一下本机各个软件的版本:

     python2.5

     Django1.3

     mod_python-3.3.1.win32-py2.5-Apache2.2

     apache2.2

5、解压Django,在Django目录中有个setyp.py文件,在命令行中运行:(这一步需要环境变量)

     python setup.py install

6、命令结束后会在D:\Python25\Lib\site-packages中生成django的目录。

7、将D:\Python25\Scripts、D:\Python25\Lib\site-packages\django\bin 添加到环境变量中。

8、安装apache2.2,这里安装过程很easy。

9、安装mod_python,这个过程在注册表中找到python2.5的安装路径,并要求手工制定apache的安装路径。

10、配置apache。

           Edit C:/Apache2.2\conf\httpd.conf,
           find where other LoadModule lines are and add this:
                LoadModule python_module modules/mod_python.so

11、创建测试工程,在命令行中执行:Django-admin.py startproject testmo。

12、命令执行完后会在当前工作目录中生成testmo文件夹,并声称一些初始化文件。

 C:\Users\Administrator\testmo 的目录
2011/07/29  15:44    <DIR>          .
2011/07/29  15:44    <DIR>          ..
2011/07/29  15:44               517 manage.py
2011/07/29  15:44             5,176 settings.py
2011/07/29  15:44               582 urls.py
2011/07/29  15:44                 0 __init__.py
               4 个文件          6,275 字节
               2 个目录 23,686,287,360 可用字节
Validating models...
0 errors found
Django version 1.3, using settings 'testmo.settings'
Development server is running at http://127.0.0.1:8000/
It worked!

Congratulations on your first Django-powered page.
Of course, you haven't actually done any work yet. Here's what to do next:
If you plan to use a database, edit the DATABASES setting in testmo/settings.py.
Start your first app by running python testmo/manage.py startapp [appname].
You're seeing this message because you have DEBUG = True in your Django settings file and you haven't configured any URLs. Get to work!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值