centos7 python2.7 django1.11 apache2.4部署

关闭防火墙

[root@www ~]# systemctl stop firewalld.service
[root@www ~]# systemctl disable firewalld.service
[root@www ~]# setenforce 0

升级pip

[root@www ~]# pip install -U setuptools
[root@www ~]# pip install -U wheel

如果提示pip命令不存在,其它系统可以参考http://sharadchhetri.com/2014/05/30/install-pip-centos-rhel-ubuntu-debian/

[root@www ~]# yum install epel-release
[root@www ~]# yum install -y python-pip

安装httpd

[root@www ~]# vi /etc/httpd/conf/httpd.conf
# line 95: change to your server's name
ServerName 
www.srv.world:80
# line 151: change
AllowOverride All
# line 164: add file name that it can access only with directory's name
DirectoryIndex index.html 
index.cgi index.php
# add follows to the end
# server's response header
ServerTokens Prod
# keepalive is ON
KeepAlive On
[root@www ~]# systemctl start httpd 
[root@www ~]# systemctl enable httpd 

安装mod_wsgi

扫描二维码关注公众号,回复: 260866 查看本文章
[root@www ~]# yum -y install mod_wsgi
[root@www ~]# vi /etc/httpd/conf.d/django.conf
# create new
WSGIDaemonProcess testapp python-path=/home/pythonweb/yumi:/usr/lib/python2.7/site-packages
WSGIProcessGroup testapp
WSGIScriptAlias /science /home/pythonweb/yumi/yumi/wsgi.py
<Directory /home/pythonweb/yumi> 
Require all granted
</Directory>
[root@www ~]# systemctl restart httpd 

  

猜你喜欢

转载自xuhuanblog.iteye.com/blog/2404068