标签:结合 appdata bash 配置文件 ali note bsp img yum
八、Djiango结合apache—wsgi模块1)安装模块
yum install -y mod_wsgi
yum install -y httpd
说明:apache 自动加载配置文件模块
cat /etc/httpd/conf.modules.d/10-wsgi.conf
LoadModule wsgi_module modules/mod_wsgi.so
2)创建一个新的配置文件
cat /etc/httpd/conf.d/django.conf
<VirtualHost *:80> WSGIDaemonProcess simplecmdb python-path=/opt/simplecmdb:/usr/lib64/python2.7/site-packages WSGIProcessGroup simplecmdb WSGIScriptAlias / /opt/simplecmdb/simplecmdb/wsgi.py Alias /static /usr/lib64/python2.7/site-packages/django/contrib/admin/static </VirtualHost> <Directory "/opt/simplecmdb/simplecmdb"> Require all granted </Directory> <Directory "/usr/lib64/python2.7/site-packages/django/contrib/admin/static"> Require all granted </Directory> WSGISocketPrefix /var/run/wsgi
说明:/opt 为项目路径,可以先拷贝出来,不能是root目录下;以及jdango包所在的路径
cp -rp simplecmdb/ /opt/
chown -R apache:apache /opt/simplecmdb
3)启动apache
4)访问
九、django结合nginx—gunicron模块
1)安装模块,需要epel扩展源
yum install -y nginx
pip install gunicron
2)修改nginx的配置文件
cat /etc/nginx/conf.d/virtual.conf server { listen 192.168.2.230:9000; server_name localhost; location /static/admin { root /usr/lib64/python2.7/site-packages/django/contrib/admin/; index index.html index.htm; } location / { proxy_pass http://localhost:8000; } }
3)启动配置文件和nginx
gunicorn simplecmdb.wsgi:application -D
systemctl start nginx.service
4)启动nginx,查看
标签:结合 appdata bash 配置文件 ali note bsp img yum
原文地址:http://blog.51cto.com/huangzp/2057528