Windows下Django配置

來源:互聯網
上載者:User
配置mod_python

1.使用apache_2.0.54-win32-x86-no_ssl.msi
http://archive.apache.org/dist/httpd/binaries/win32/

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

mod_python中文文檔
http://man.chinaunix.net/develop/python/mod_python/mod_python.h

3.配置Apache2\conf\httpd.conf

添加
LoadModule python_module modules/mod_python.so

<Directory "D:/Apache Group/Apache2/htdocs">        AddHandler mod_python .py        PythonHandler mptest        PythonDebug On</Directory>

4.瀏覽http://localhost:8080/mptest.py,測試mod_python是否配置成功

配置Django

http://thinkhole.org/wp/2006/04/03/django-on-windows-howto/
Django Step by Step

1.http://tortoisesvn.sourceforge.net/ 下載tortoisesvn
簽出http://code.djangoproject.com/svn/django/trunk/django
Copy django 到 E:\Python24\Lib\site-packages\
Copy E:\Python24\Lib\site-packages\django\bin\django-admin.py 到 E:\Python24\Scripts

2.通過shell,運行import django,如果成功運行,證明安裝成功

3.建立Web項目,路徑E:\mysite
先添加環境變數,Path=E:\Python24\;E:\Python24\Scripts;
建議添加PATHEXT=.py
django-admin.py 就可以不帶副檔名執行

E:\mysite>django-admin.py startproject mysite

產生了一個mysite目錄,包含__init__.py, manage.py, settings.py, urls.py
__init__.py 說明mysite是一個python包
manage.py 管理應用程式
settings.py 配置應用程式
urls.py URL映射

E:\mysite>python manage.py runserver

查看http://localhost:8000/頁面

4.配置到Apache

<Location "/mysite/">    SetHandler python-program    PythonHandler django.core.handlers.modpython    SetEnv DJANGO_SETTINGS_MODULE mysite.settings    PythonPath "['E:\mysite'] + sys.path"    PythonDebug On</Location><Location "/media/">    SetHandler None</Location><LocationMatch "\.(jpg|gif|png)$">    SetHandler None</LocationMatch>

瀏覽http://localhost:8080/mysite/

5.安裝資料庫
postgresql
http://wwwmaster.postgresql.org/download/mirrors-ftp?file=binary%2Fv8.1.3%2Fwin32%2Fpostgresql-8.1.3-1.zip

SQLite
http://www.sqlite.org/download.html

pysqlite
http://www.initd.org/tracker/pysqlite

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.