Ubuntu 虚拟主机Django部署全代码

前端之家收集整理的这篇文章主要介绍了Ubuntu 虚拟主机Django部署全代码前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Apache2.4 + ubuntu +

<VirtualHost *:80>

    ServerName m.roothan.com
    #ServerAlias b.roothan.com a.roothan.com 
    ServerAdmin actanble@163.com

    #Alias /robots.txt /home/water/mysite2/static/robots.txt
    #Alias /favicon.ico /home/water/mysite2/static/favicon.ico

    Alias /media/ /home/water/mysite2/media/
    Alias /static/ /home/water/mysite2/collect_static/

    <Directory /home/water/mysite2/media>
        Require all granted
    </Directory>

    <Directory /home/water/mysite2/collect_static>
        Require all granted
    </Directory>

    WSGIScriptAlias /  /home/water/mysite2/minicms/wsgi.py
    # WSGIDaemonProcess mysite2 python-home=/home/water/venv3 python-path=/home/water/mysite2:/home/water/venv3/lib/python3.4/site-packages
    # WSGIProcessGroup actanble.com
    <Directory /home/water/mysite2/minicms>
    <Files wsgi.py>
        Require all granted
    </Files>
    </Directory>

</VirtualHost>
WSGIPythonpath /home/water/mysite2

wsgi.py

import os
from os.path import join,dirname,abspath

PROJECT_DIR = dirname(dirname(abspath(__file__))) 
import sys 

sys.path.insert(0,PROJECT_DIR)

os.environ["DJANGO_SETTINGS_MODULE"] = "minicms.settings" 

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()
原文链接:https://www.f2er.com/ubuntu/352713.html

猜你在找的Ubuntu相关文章