Warning
Security features in Domogik will be managed in a futur release. So external access to Domogik is not a good idea for security issues. You should do this only for test or demonstration purposes.
Note
Following instructions are Debian/Ubuntu ones. Feel free to complete for your distribution.
Todo
Add schema to understand
Deploying Django with Apache and mod_wsgi is the recommended way to get Django working in production mode. mod_wsgi is an Apache module which can be used to host any Python application which supports the Python WSGI interface, including Django.
See here for an exhaustive description about mod_wsgi.
$ apt-get install libapache2-mod-wsgi
Then check your /usr/lib/apache2/modules directory and make sure the file mod_wsgi.so is pointing to mod_wsgi.so-2.6. If it’s not the case just do:
$ ln -sf /usr/lib/apache2/modules/mod_wsgi.so-2.6 /usr/lib/apache2/modules/mod_wsgi.so
At the top of the django directory (i.e. where settings.py lives), create a subdirectory named apache. Create in this directory a file named django.wsgi with this content (eventually adapt the python path to your needs) :
#!/usr/bin/python2.6
import os
import site
site.addsitedir('/usr/local/lib/python2.6/dist-packages')
os.environ['DJANGO_SETTINGS_MODULE'] = 'domogik.ui.djangodomo.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
First enable the rewrite module :
a2enmod rewrite
Add for example a virtual host like this :
<VirtualHost *:80>
ServerName domogik.myserver.org
RewriteEngine on
RewriteRule ^/$ http://domogik.myserver.org/domogik/ [R=301,L]
WSGIDaemonProcess domogik user=domogik group=domogik processes=5 threads=1
WSGIProcessGroup domogik
WSGIScriptAlias / /home/domogik/dmg/src/domogik/ui/djangodomo/apache/django.wsgi
<Directory /home/domogik/dmg/src/domogik/ui/djangodomo/apache>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Please note a few things :
Finally, restart Apache:
$ /etc/init.d/apache2 restart
Before doing this, don’t forget that django is not made to be directly accessible over the internet :
Now’s a good time to note: DON’T use this server in anything resembling a production environment. It’s intended only for use while developing.
—source : http://docs.djangoproject.com/en/1.2/intro/tutorial01/#intro-tutorial01
Notice that doing this will make all your local Domogik use go through the internet.