Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
          1. 安裝 apach2 服務(wù)器。
          這個很簡單,從官網(wǎng)上下載源代碼,httpd-2.2.9.tar.gz,解壓縮后 configure , make ,make install. 會安裝在/usr/local/目錄下。
          使用命令/usr/local/apache2/bin/apachectl start     開啟apache服務(wù)。
          使用命令/usr/local/apache2/bin/apachectl stop     停止apache服務(wù)。
          使用命令/usr/local/apache2/bin/apachectl restart 重新啟動apache服務(wù)。

          2. 安裝python 2.5
          從官網(wǎng)上下載2.5版本,Python-2.5.2.tgz,解壓縮后./configure, make , make install.就可以完成安裝。默認(rèn)安裝目錄為/usr/local/lib/python2.5/
          3. 安裝mod_python.
          ./configure –with-apxs=/usr/local/apache2/bin/apxs –with-python=/usr/bin/python2.5,再make, make install 即可。安裝完畢后會在目錄/usr/local/apache2/modules下有文件mod_python.so,這個在后面要使用到。
          4. 安裝django 1.0
          官網(wǎng)下 載1.0版本Django-1.0.tar.gz,解壓縮,使用命令python setup.py install 安裝,注意,如果機器里有以前的版本,一定要把以前的版本文件完全卸載活刪除,django 不會覆蓋以前的文件。默認(rèn)安裝目錄為/usr/local/lib/python2.5/site-packages/django/
          5.安裝sqlite
          這里使用到的數(shù)據(jù)庫為sqlite3,所以要安裝相應(yīng)的包,這里 從官網(wǎng)下載pysqlite-2.3.5.tar.gz,安裝很容易。
          6.配置文件.
          這里使用了最簡單的配置方法,直接修改/usr/local/apache2/conf/httpd.conf
          (1) ,默認(rèn)端口,80,可以不修改。
          (2) 在有LoadModule example字樣的下面添加一下一行
          LoadModule python_module modules/mod_python.so
          (3) 配置ServerName,在有 #ServerName www.example.com:80字樣的下面添加一下行:
          ServerName yourIP:80
          (4) 這是最重要的一步了。在有字樣# This should be changed to whatever you set DocumentRoot to.的后面,修改<Directory> … </Directory>中間的內(nèi)容為:

          <Directory “/home/af/af“>
          #
          # Possible values for the Options directive are “None”, “All”,
          # or any combination of:
          #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
          #
          # Note that “MultiViews” must be named *explicitly* — “Options All”
          # doesn’t give it to you.
          #
          # The Options directive is both complicated and important. Please see
          # http://httpd.apache.org/docs/2.2/mod/core.html#options
          # for more information.
          #
          #Options Indexes FollowSymLinks
          #PythonHandler django.core.handlers.modpython
          PythonPath “['/home/af/af','/usr/local/lib/python2.5/site-packages'] + sys.path”
          PythonHandler django.core.handlers.modpython
          SetEnv DJANGO_SETTINGS_MODULE aftest.settings
          SetHandler python-program
          PythonDebug On

          #
          # AllowOverride controls what directives may be placed in .htaccess files.
          # It can be “All”, “None”, or any combination of the keywords:
          #   Options FileInfo AuthConfig Limit
          #
          #AllowOverride None

          #
          # Controls who can get stuff from this server.
          #
          #Order allow,deny
          Allow from all

          </Directory>

          其中藍色部分為要修改和添加的部分,/home/af/af是Django 工程所在的目錄,aftest為項目名稱。
          (5)添加media。這里以安裝Django自己提供的admin為例。
          在上一步的</Directory>下面再添加
          Alias /media /usr/local/lib/python2.5/site-packages/django/contrib/admin/media
          <Location “/media”>
          Options None
          SetHandler None
          Allow from all
          </Location>

          即可。

          配置完畢。

          posted on 2008-11-06 15:59 seal 閱讀(567) 評論(0)  編輯  收藏 所屬分類: Python
          主站蜘蛛池模板: 禹城市| 莱阳市| 开平市| 宜良县| 安图县| 延津县| 忻州市| 重庆市| 河西区| 吴旗县| 定结县| 五常市| 呼和浩特市| 鹤山市| 惠东县| 盈江县| 江北区| 福安市| 枣强县| 陵水| 曲水县| 绥江县| 东阿县| 大港区| 皮山县| 左贡县| 抚州市| 伊通| 怀集县| 哈尔滨市| 贺兰县| 合肥市| 普宁市| 会宁县| 茂名市| 澄迈县| 西和县| 塘沽区| 大洼县| 讷河市| 葫芦岛市|