Django project & apps that implement the web-app front-end for the Home Control system.
See my blog post for extended description and design.
Additional Home-Control projects:
- Django (developed and tested with v1.5).
- Django JS Reverse.
As a Django project & apps, installation and deployment are not different than other Django projects (several deployment configuration examples below).
- Clone the repository to the server machine that will serve the site.
- Optionally, create a
local_settings.py
file inHomeControlWeb/HomeControlWeb
to override settings from the generic settings (feel free to use local_settings.py.sample as a suggestion). - Run
manage.py syncdb
to initialize the DB (and create a super user). - Set up your web server of choice to serve the Django site.
- Deploy the static files to your web server of choice (global static files as well as app-specific static files!).
- Access the admin interface (e.g. at
http://your-deployed-host/admin/
) to configure the installed apps (see the app-specific documentation for details on their configurations). - Win.
(tested with Ubuntu-Desktop-12.04.2-x64)
Install requirements:
- Python and various dependencies:
sudo apt-get install libexpat1 python-pip build-essential python-imaging python-pythonmagick python-markdown python-textile python-docutils
- WARNING: Do not install python-django via apt-get on 12.04 - the default repositories has an old version...
- Django, Django JS Reverse:
sudo pip install Django django-js-reverse
Create webmasters group:
sudo groupadd webmasters
sudo usermod -a -G webmasters <username>
Create directories for static and media and configure ownerships:
sudo mkdir -p /var/www/home-control-web/static
sudo chown www-data:webmasters -R /var/www/home-control-web/static
sudo mkdir -p /var/www/home-control-web/media/webcam
sudo chown www-data:webmasters -R /var/www/home-control-web/media
Clone and configure the home-control-web project:
cd ~
git clone https://github.com/itamaro/home-control-web.git
cd home-control-web/HomeControlWeb/HomeControlWeb
-
cp local_settings.py.sample local_settings.py
- Edit
local_settings.py
till happy.
- Edit
cd ..
python manage.py syncdb
- Create a super user
Deploy Django static files to statically served directory:
cd ~/home-control-web/HomeControlWeb
python manage.py collectstatic
After setting up a web server to serve the Django site (and static and media directories) (see web-server-specific examples below),
access the Django admin interface (e.g. https://your.domain.com/home-control/admin/
) to configure the installed apps (see app-specific README's for further details).
(tested with Ubuntu-Desktop-12.04.2-x64)
Install Apache & mod-wsgi:
- Apache2, mod-WSGI:
sudo apt-get install apache2 apache2-mpm-prefork libapache2-mod-wsgi
Add Apache to the webmasters group:
sudo usermod -a -G webmasters www-data
Create a virtual host conf file for the Apache site:
cd /etc/apache2
sudo <your-favorite-editor> sites-available/home-control-web
<VirtualHost *:80>
ServerAdmin <your@email>
Alias /static/ /var/www/home-control-web/static/
Alias /media/ /var/www/home-control-web/media/
WSGIScriptAlias /home-control /home/username/home-control-web/HomeControlWeb/HomeControlWeb/wsgi.py
WSGIDaemonProcess home-control python-path=/home/<username>/home-control-web/HomeControlWeb
WSGIProcessGroup home-control
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/home-control-web/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory /home/<username>/home-control-web/HomeControlWeb/HomeControlWeb>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Disable the default site and enable to home control web site:
sudo a2dissite 000-default
sudo a2ensite home-control-web
Reload the Apache server:
sudo service apache2 reload
Soon
(my dev-env is Windows 7 Professional SP1 x64)
- Install Python, setuptools, pip, Git client (e.g. Git Extensions)
pip install Django django-js-reverse south
- Clone
https://github.com/itamaro/home-control-web.git
to your local workspace (e.g.C:\Users\<name>\Workspaces\home-control\home-control-web
. - Copy
local_settings.py.win-dev-sample
tolocal_settings.py
in theHomeControlWeb\HomeControlWeb
directory.- Edit it until you're happy.
- In command prompt, cd to
C:\Users\<name>\Workspaces\home-control\home-control-web\HomeControlWeb
-
python manage.py syncdb
- Create super user.
- Create
media\webcam
directory next to the globalstatic
directory. python manage.py runserver
The home-control site is now available on http://localhost:8000/
-
access /admin/
to configure app-settings, and hack away at the project.
You would probably also want to set up a local development environment of the home-control-RPC project in order to have a fully functional setup.
Please share interesting stuff you do!