前提:apache服务器已经安装好
ps:
安装Apache的WSGI 模块, sudo apt-get install libapache2-mod-wsgi .
可以使用a2enmod wsgi来验证是不是已经安装成功。
1,修改wsgi.py文件 加入path中
"""
WSGI config for oakcloud project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/"""
import os,sys
sys.path.append("/home/geiao/PycharmProjects/oakcloud")
sys.path.append("/home/geiao/PycharmProjects/oakcloud/oakcloud")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "oakcloud.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
2,修改apache的配置文件
: /etc/apache2/sites-available$ vi default
<VirtualHost *:80>
里面增加以下
WSGIScriptAlias / "/home/geiao/PycharmProjects/oakcloud/oakcloud/wsgi.py" //项目的位置
<Directory "/home/geiao/PycharmProjects/oakcloud/oakcloud">
Order deny,allow
Allow from all
</Directory>
Alias /static /home/geiao/PycharmProjects/oakcloud/static //添加静态文件
<Directory /home/geiao/PycharmProjects/oakcloud/static>
Order deny,allow
Allow from all
</Directory>
然后重启下apache服务器 ok.
标签:wsgi,部署,oakcloud,django1.6,geiao,PycharmProjects,apache,home From: https://blog.51cto.com/u_15939105/6003865