From f8c08cb71916b3a3ea8938df49895db75d51988a Mon Sep 17 00:00:00 2001
From: Jan Krcmar <honza801@gmail.com>
Date: Tue, 22 Dec 2015 15:04:23 +0100
Subject: [PATCH] wsgi.py customized for use mod_wsgi with apache module

---
 README.md            | 6 ++++++
 webvirtcloud/wsgi.py | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 29d266d..f1b3767 100644
--- a/README.md
+++ b/README.md
@@ -185,6 +185,12 @@ webvirtcloud                     RUNNING    pid 24185, uptime 2:59:14
 
 ```
 
+#### Apache mod_wsgi configuration
+```
+WSGIDaemonProcess webvirtcloud threads=2 maximum-requests=1000 display-name=webvirtcloud
+WSGIScriptAlias / /srv/webvirtcloud/webvirtcloud/wsgi.py
+```
+
 #### Install final required packages for libvirtd and others on Host Server
 ```bash
 wget -O - https://clck.ru/9V9fH | sudo sh
diff --git a/webvirtcloud/wsgi.py b/webvirtcloud/wsgi.py
index 35ceb9b..a9bf44c 100644
--- a/webvirtcloud/wsgi.py
+++ b/webvirtcloud/wsgi.py
@@ -7,7 +7,10 @@ For more information on this file, see
 https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
 """
 
-import os
+execfile('/srv/webvirtcloud/venv/bin/activate_this.py', dict(__file__='/srv/webvirtcloud/venv/bin/activate_this.py'))
+
+import os, sys
+sys.path.append('/srv/webvirtcloud')
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirtcloud.settings")
 
 from django.core.wsgi import get_wsgi_application