当前位置:首页 > 开发 > 编程语言 > 编程 > 正文

How to install Django

发表于: 2011-04-29   作者:crabdave   来源:转载   浏览次数:
摘要: How to install Django Downloading these software and then installing them as follow: python:  http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi PIL for py2.4:  http://www.pythonwa

How to install Django

Downloading these software and then installing them as follow:

python:  http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi

PIL for py2.4:  http://www.pythonware.com/products/pil/

Django:  http://media.djangoproject.com/releases/0.95/Django-0.95.4.tar.gz

apache:  http://apache.justdn.org/httpd/binaries/win32/apache_2.0.58-win32-x86-no_ssl.msi

mod_python:  http://apache.justdn.org/httpd/modpython/win/3.2.8/mod_python-3.2.8.win32-py2.4.exe

 

you can also find them as attachments in this page.

 

Entering Django-0.95.4 directory

Using 'python ez_setup.py' command to check whether 'setuptool' is existent or not, if it is not existent, then it will download automatically from internet.

 

Then installing Django

Using 'python setup.py install' command to install Django to site-package directory and configure the sys.path file.

You can also check it out in terminal using:

import sys

print sys.path

 

Checking 'mod_python.so' out in 'D:\Program Files\Apache Group\Apache2\modules' directory

 

Modifying appach conf/httpd.conf file

Adding following things:

 

'LoadModule python_module modules/mod_python.so'

 

<Directory "D:/Program Files/Apache Group/Apache2/htdocs/test">

    AddHandler mod_python .py

  PythonHandler pythonTest

  PythonDebug On

</Directory>

 

Creating a ‘pythonTest.py’ file in the test directory, like this(paying more attention on code formatting):

 

from mod_python import apache
def handler(req):
       req.content_type = 'text/plain' 

        req.write("Hello World!\n")
        return apache.OK

 

 

 

 

Restart appach

Using following address:

http://127.0.0.1/test/pythonTest.py

 

'Hello World!' appears on the page.

 

 

Next, creating a django project.

 

Entering D:\Program Files\Python24\Scripts directory

Using 'django-admin.py startproject newtest' command to create a new django project.

 

Cutting the newtest directory and then pasting in D:\Program Files\Python24\Lib\site-packages directory

 

Modifying appach conf/httpd.conf file

<Location "/newtest/">  

    SetHandler python-program  

    PythonPath "sys.path+['D:/Program Files/Python24/Lib/site-packages/newtest']" 

    PythonHandler django.core.handlers.modpython  

    SetEnv DJANGO_SETTINGS_MODULE newtest.settings

    PythonDebug On  

</Location> 

 

Restart appach

Using following address:

http://127.0.0.1/newtest/

 

It works!

 

LOL 

 

 

 

 

 

 

 

How to install Django

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

编辑推荐
How to Install Ubuntu on Android! (Windows) First, download the following Ubuntu.zip file (fr
/* Author: Jiangong SUN */ It takes me sometime to successfully install SharePoint 2010 on Wi
VBOX安装Linux Centos CentOS属于RedHat,安装CentOS在Vbox里面,唯一需要注意的就是版本是RedHat,
Ubuntu 9.10, Karmic Koala is finally out now and everybody wants to install it. But since the
Here is how you can install MVVM Light Toolkit via NuGet in an easy way using only Visual Stu
This tutorial was last updated on June 27, 2013 After following many outdated and incomplete
A Linux system administrator usually work from remote to manage his server.While managing tho
Note: Following steps(step1---8) need you ensure do not insert the aircard into the PCMCIA sl
Newest VCI 2 SDP3 2.23 diagnostic tool with multi-language is professionally designed for dia
BEFORE STARTING IT IS IMPORTANT TO KNOW THAT THIS ENVIRONMENT IS NOT SUPPORTED BY MICROSOFT.
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号