Django+ Mod_wsgi

  1. 安装环境

   centos 6.4

    apache 2.2

    python 2.7

    sqlite3


2.软件安装

    1.安装apache 

         yum install -y httpd  httpd-devel

    2.安装sqlite3       

        wget http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz

        tar xvzf sqlite-autoconf-3070500.tar.gz

        cd sqlite-autoconf-3070500

        ./configure

        make

        make install

 


         yum install sqlite-devel

    3.安装pyhton 2.7

        yum install -y zlib zlib-devel


           

        tar -xzvf Python-2.7.tar.bz2

        cd Python-2.7

        ./configure --enable-shared

         

      4. 安装django  mod_wsg

      5.配置 httpd


        LoadModule wsgi_module modules/mod_wsgi.so     

        <VirtualHost *:80>

         ServerName m1.testt.com

         DocumentRoot /mnt/web/colt

         ServerAlias  m1.test.com

         <Directory "/mnt/web/colt">

         Order allow,deny

         Allow from all

         </Directory>

         WSGIScriptAlias /colt /mnt/web/colt/apache/django.wsgi

         <Directory "/mnt/web/colt/apache">

         AllowOverride AuthConfig FileInfo

         Options -Indexes FollowSymLinks

         Order allow,deny

         Allow from all

         </Directory>

        </VirtualHost>


6.django.wsgi 内容


        #!/usr/bin/env python

        import os

        import sys

        import django.core.handlers.wsgi

        

        os.environ['DJANGO_SETTINGS_MODULE'] = 'colt.settings'

        os.environ['PYTHON_EGG_CACHE'] = '/tmp'

        application = django.core.handlers.wsgi.WSGIHandler()

        path = '/mnt/web/colt'

        if path not in sys.path:

            sys.path.append(path)




  




    

你可能感兴趣的:(django,apche,wsgi,centps)