必要モジュールのインストール(ubuntu)
sudo apt-get install libapache2-mod-wsgi
sudo a2enmod wsgi
apache設定ファイル( httpd.confなど)
<VirtualHost *:80>
ServerName b.ytyng.com
DocumentRoot /data/htdocs/b.ytyng.com
ErrorLog /var/log/apache2/b.ytyng.com/error.log
CustomLog /var/log/apache2/b.ytyng.com/access.log combined
LogLevel warn
Alias /static /DJANGO-ROOT/static
Alias /static-admin /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media
WSGIScriptAlias / /DJANGO-ROOT/wsgi/index.wsgi
WSGIDaemonProcess b.ytyng.com user=www-data group=www-data processes=1 threads=15 home=/ maximum-requests=1000 shutdown-timeout=30
WSGIProcessGroup b.ytyng.com
WSGIPassAuthorization On
</VirtualHost>
index.wsgi
# -*- mode: Python; -*-
import os
import sys
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if path not in sys.path:
sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
コメント