django apache mod_wsgi部署

环境:Linux RedHat6.3 Apache2.2.15 ptyhon2.7.10 django1.8.7

纯净linux环境安装

1.preparation

yum  install  gcc
yum  install  git
yum  install  zlib
yum  install  sqlite3
yum  install  zlib-devel
yum  install  openssl-devel
yum  install  mysql-devel -y
#yum install python-cx-oracle-ebay
 
2.apache
wget http: //mirrors .sonic.net /apache//httpd/httpd-2 .2.31. tar .gz
tar  zvxf httpd-2.2.31. tar .gz
cd  httpd-2.2.31
mkdir  /usr/local/apache2
. /configure  --prefix= /usr/local/apache2
 
3.python
wget https: //www .python.org /ftp/python/2 .7.10 /Python-2 .7.10.tgz
tar  zxvf Python-2.7.10.tgz
cd  Python-2.7.10
mkdir  /usr/local/python27
. /configure  --prefix= /usr/local/python27  -- enable -shared
make
make  install
 
cd  /usr/bin/
mv  python python.ori
ln  -s  /usr/local/python27/bin/python2 .7  /usr/bin/python
vi  /usr/bin/yum
replace  "#!/usr/bin/python"  with  "#!/usr/bin/python2.6"
 
4.setuptools & pip
ln  -s  /usr/local/python27/bin/python2 .7  /usr/bin/python2 .7 
wget https: //pypi .python.org /packages/2 .7 /s/setuptools/setuptools-0 .6c11-py2.7.egg --no-check-certificate
chmod  +x setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg
 
wget https: //bootstrap .pypa.io /get-pip .py
python get-pip.py
 
if  pip,easy_install can't work, here they are:
/usr/local/python27/bin/pip
/usr/local/python27/bin/easy_install
5.wsgi
wget https: //github .com /GrahamDumpleton/mod_wsgi/archive/4 .4.21.zip
unzip 4.4.21
cd  mod_wsgi-4.4.21/
. /configure  --with-python= /usr/local/python27/bin/python2 .7
make
make  install
 
6.  install  cx_Oracle  for  python2.7
1)  install  oracle client
Instant Client Package - Basic
Instant Client Package - SDK
Instant Client Package - SQL*Plus
http: //www .oracle.com /technetwork/topics/linuxx86-64soft-092277 .html
2)  install /unzip  oracle client to  /opt/oracle/instantclient_12_1
 
3) Set environments and  make  sure pip is
export  LD_LIBRARY_PATH= /opt/oracle/instantclient_12_1
export  ORACLE_HOME= /opt/oracle/instantclient_12_1
export  LD_RUN_PATH= /opt/oracle/instantclient_12_1
--link oracle lib to sys path
ln  -s  /opt/oracle/instantclient_12_1/libclntsh .so.12.1  /usr/lib64/libclntsh .so
4) pip  install
make  sure pip is  for  python2.7
pip  install  cx_Oracle
pip  install  django
pip  install  mod_wsgi
pip  install  mysql-python
pip  install  httplib2
pip  install  pymongo
pip  install  requests
pip  install  elasticsearch
pip  install  demjson
pip  install  paramiko
pip  install  fabric
pip  install  dnspython
 
7.virtualenv
pip  install  virtualenv==1.8.7
virtualenv --system-site-packages ENV
cd  env
source  bin /activate    #"deactivate" to exit virtualenv
 
6.apache http.conf
add
WSGIPythonHome  /usr/local/python27 
WSGIScriptAlias /  /home/jnshi/db-in-box/DBInBoxWeb/dbinabox/wsgi .py
WSGIPythonPath  /home/jnshi/db-in-box/DBInBoxWeb : /home/jnshi/ENV (virtualenv path) /lib/python2 .7 /site-packages
<Directory  /home/jnshi/db-in-box/DBInBoxWeb/dbinabox >
<Files wsgi.py>
Order deny,allow
Allow from all
< /Files >
< /Directory >

 

你可能感兴趣的:(django apache mod_wsgi部署)