Configure external access to Domogik


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.

First method : Apache configuration for web access using wsgi (optional)


Following instructions are Debian/Ubuntu ones. Feel free to complete for your distribution.


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.

Configure mod_wsgi

$ apt-get install libapache2-mod-wsgi

Then check your /usr/lib/apache2/modules directory and make sure the file is pointing to If it’s not the case just do:

$ ln -sf /usr/lib/apache2/modules/ /usr/lib/apache2/modules/

Create your wsgi file

At the top of the django directory (i.e. where 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) :

import os
import site
os.environ['DJANGO_SETTINGS_MODULE'] = 'domogik.ui.djangodomo.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Add an entry to your Apache configuration file

First enable the rewrite module :

a2enmod rewrite

Add for example a virtual host like this :

<VirtualHost *:80>
    RewriteEngine on
    RewriteRule ^/$ [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

Please note a few things :

  • For WSGIDaemonProcess, user and group should be the ones you are using to run your domogik installation (see /etc/default/domogik).
  • Adapt path for both WSGIScriptAlias and Directory directive to your needs.

Finally, restart Apache:

$ /etc/init.d/apache2 restart

Second method : port binding

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 :

  • bind Django port on your box.
  • bind REST port on your box.
  • configure /etc/domogik/domogik.cfg file to use your public internet IP.

Notice that doing this will make all your local Domogik use go through the internet.