码迷,mamicode.com
首页 > 其他好文 > 详细

Django+ Mod_wsgi

时间:2014-08-08 16:26:17      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:django apche wsgi centps sqlite3

  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)




  




    

本文出自 “python django jqurey” 博客,请务必保留此出处http://tomyu.blog.51cto.com/705648/1537363

Django+ Mod_wsgi,布布扣,bubuko.com

Django+ Mod_wsgi

标签:django apche wsgi centps sqlite3

原文地址:http://tomyu.blog.51cto.com/705648/1537363

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!