search
HomeBackend DevelopmentPython TutorialPython+Django在windows下的开发环境配置图解

1         安装配置开发环境

1.1   准备安装

下载以下软件

Eclipse for C/C++

SUN JDK 1.6 不一定要1.6,1.5的也可以

Python3.1  Python2.6.4  Pythone2.5.2

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

MySQL-python-1.2.2.win32-py2.5

pysqlite-2.5.5.win32-py2.5

python.pydev.feature-1.5.0.1251989166-sources.zip

Django-1.1.1.tar.gz

 

1.2   Apache安装配置

懒得配置了,直接从网上找了一个Apache+mysql+php的套件,

可以去http://www.newhua.com/soft/71111.htm下载,再安装mod_python-3.3.1.win32-py2.5-Apache2.2.exe让apache支持python现在我们来配置C:\ ESSamp\Apache2\conf\httpd.conf文件,加入

LoadModule python_module modules/mod_python.so

 

运行ESSamp,点击“运行”启动服务

 

Python+Django在windows下的开发环境配置图解

 

 

点击“浏览默认网站”,看到以下画面,即安装成功

Python+Django在windows下的开发环境配置图解

 

1.1   Eclipse、python安装配置

1.1.1          安装 JDK

1.1.2          解压Eclipse,我是放在C:\eclipse下

1.1.3          安装python

安装相应Python版本,这里用的是python2.5版,现在Django只支持到2.5,其它各版本可以同时存在,安装MySQL-python-1.2.2.win32-py2.5 让python支持mysql数据库,pysqlite-2.5.5.win32-py2.5让python支持sqlite数据库,解压python.pydev.feature-1.5.0.1251989166-sources.zip,将里面的两个目录拷贝到eclipse安装的根目录下“C:\eclipse”

1.1.4          配置环境变量,在桌面“我的电脑”点击“属性”菜单,选择“高级”选项卡,点击“环境变量…”按钮,修改系统变量 Path=;%JAVA_HOME%\bin,直接加在后面,如图

Python+Django在windows下的开发环境配置图解

 

再新增两个系统变量

JAVA_HOME=C:\Program Files\Java\jdk1.6.0

CLASSPATH=.;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar

Python+Django在windows下的开发环境配置图解

1.1.5          启动Eclipse,选择菜单“Help”->“Install New Software…”,弹出对话框,如图

Python+Django在windows下的开发环境配置图解

 

点击“Add…”按钮,输入地址,点击“OK”按钮,如图

Python+Django在windows下的开发环境配置图解

 

在“work with”选择刚新添加的Pydev Extensions,会看到最新的软件版本

Python+Django在windows下的开发环境配置图解

全选后点击“Next>”

Python+Django在windows下的开发环境配置图解

全选后点击“Finish”完成升级。

 

1.1.6          选择菜单“Window”->“Preferences”,弹出对话框,如图

Python+Django在windows下的开发环境配置图解

点击“New…”按钮装python安装路径添加进来,点击“OK”。

1.2   Django安装配置

1.2.1          安装

解压Django,我是解压到python25下,在Django目录中有个setyp.py文件,打开运行窗口进行安装Python+Django在windows下的开发环境配置图解

1.2.2          为了方便开发,我们再来进行配置系统变量

path= C:\Python25\Scripts;C:\Python25\Lib\site-packages\django\bin

1.2.3          测试Django是否安装成功

首先看看C:\Python25\Lib\site-packages\django\bin是否存在,然后创建一个工程

   Django-admin.py  startproject  testemo

Python+Django在windows下的开发环境配置图解

 

运行manage.py runserver 后,在浏览器地址栏中输入http://127.0.0.1:8000/

Python+Django在windows下的开发环境配置图解 

出现以上画面,即安装成功

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are some common reasons why a Python script might not execute on Unix?What are some common reasons why a Python script might not execute on Unix?Apr 28, 2025 am 12:18 AM

The reasons why Python scripts cannot run on Unix systems include: 1) Insufficient permissions, using chmod xyour_script.py to grant execution permissions; 2) Shebang line is incorrect or missing, you should use #!/usr/bin/envpython; 3) The environment variables are not set properly, and you can print os.environ debugging; 4) Using the wrong Python version, you can specify the version on the Shebang line or the command line; 5) Dependency problems, using virtual environment to isolate dependencies; 6) Syntax errors, using python-mpy_compileyour_script.py to detect.

Give an example of a scenario where using a Python array would be more appropriate than using a list.Give an example of a scenario where using a Python array would be more appropriate than using a list.Apr 28, 2025 am 12:15 AM

Using Python arrays is more suitable for processing large amounts of numerical data than lists. 1) Arrays save more memory, 2) Arrays are faster to operate by numerical values, 3) Arrays force type consistency, 4) Arrays are compatible with C arrays, but are not as flexible and convenient as lists.

What are the performance implications of using lists versus arrays in Python?What are the performance implications of using lists versus arrays in Python?Apr 28, 2025 am 12:10 AM

Listsare Better ForeflexibilityandMixdatatatypes, Whilearraysares Superior Sumerical Computation Sand Larged Datasets.1) Unselable List Xibility, MixedDatatypes, andfrequent elementchanges.2) Usarray's sensory -sensical operations, Largedatasets, AndwhenMemoryEfficiency

How does NumPy handle memory management for large arrays?How does NumPy handle memory management for large arrays?Apr 28, 2025 am 12:07 AM

NumPymanagesmemoryforlargearraysefficientlyusingviews,copies,andmemory-mappedfiles.1)Viewsallowslicingwithoutcopying,directlymodifyingtheoriginalarray.2)Copiescanbecreatedwiththecopy()methodforpreservingdata.3)Memory-mappedfileshandlemassivedatasetsb

Which requires importing a module: lists or arrays?Which requires importing a module: lists or arrays?Apr 28, 2025 am 12:06 AM

ListsinPythondonotrequireimportingamodule,whilearraysfromthearraymoduledoneedanimport.1)Listsarebuilt-in,versatile,andcanholdmixeddatatypes.2)Arraysaremorememory-efficientfornumericdatabutlessflexible,requiringallelementstobeofthesametype.

What data types can be stored in a Python array?What data types can be stored in a Python array?Apr 27, 2025 am 12:11 AM

Pythonlistscanstoreanydatatype,arraymodulearraysstoreonetype,andNumPyarraysarefornumericalcomputations.1)Listsareversatilebutlessmemory-efficient.2)Arraymodulearraysarememory-efficientforhomogeneousdata.3)NumPyarraysareoptimizedforperformanceinscient

What happens if you try to store a value of the wrong data type in a Python array?What happens if you try to store a value of the wrong data type in a Python array?Apr 27, 2025 am 12:10 AM

WhenyouattempttostoreavalueofthewrongdatatypeinaPythonarray,you'llencounteraTypeError.Thisisduetothearraymodule'sstricttypeenforcement,whichrequiresallelementstobeofthesametypeasspecifiedbythetypecode.Forperformancereasons,arraysaremoreefficientthanl

Which is part of the Python standard library: lists or arrays?Which is part of the Python standard library: lists or arrays?Apr 27, 2025 am 12:03 AM

Pythonlistsarepartofthestandardlibrary,whilearraysarenot.Listsarebuilt-in,versatile,andusedforstoringcollections,whereasarraysareprovidedbythearraymoduleandlesscommonlyusedduetolimitedfunctionality.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft