Im3nsa Development Server
Im3nsa comes with everything you need to quickly get started with development. Note that development and deployment has only been tested on OSX and Ubuntu, you’ll likely need to modify the directions below if using Windows.
You’ll need the following to get started:
- PostgreSQL 9.3 or later along with the PostGIS extensions. You probably want to refer to Django’s installation instructions to help get this working.
- Redis 2.8 or later installed and listening on localhost. By default the development server uses database 15.
- lessc, the Less compiler.
- coffee, the Coffee script compiler.
- libmagic or libmagic-dev depending on your development platform. Required by https://github.com/dveselov/python-libmagic.
Create temba user for PostgreSQL
$ createuser temba --pwprompt -d Enter password for new role: Enter it again:
Create temba database, add PostGIS
Create the database as temba user:
$ psql --user=temba postgres postgres=> create database temba; CREATE DATABASE
Now connect as a superuser that can install extensions:
$ psql postgres=# \c temba You are now connected to database "temba" as user "psql". temba=# create extension postgis; CREATE EXTENSION temba=# create extension postgis_topology; CREATE EXTENSION temba=# create extension hstore; CREATE EXTENSION temba=# create extension "uuid-ossp"; CREATE EXTENSION
Now clone the Im3nsa repository and link up the development settings:
$ git clone firstname.lastname@example.org:im3nsa/im3nsa.git $ cd Im3nsa $ ln -s temba/settings.py.dev temba/settings.py
Build virtual environment
You should always use a virtual environment to run your Im3nsa installation. The pinned dependencies for Im3nsa can be found in
pip-freeze.txt. You can build the needed environment as follows (from the root im3nsa directory):
$ virtualenv env $ source env/bin/activate (env) $ pip install -r pip-freeze.txt
Sync your database
You should now be able to run all the migrations and initialize your development server. This takes a little while on Im3nsa as migrate also creates and initializes all the user groups and permissions.
$ python manage.py migrate
Install bower scripts
Before you can run your server, you will need the web-tier dependencies. These are managed by bower (see bower.json in the root for more details).
$ bower install
Run development server
At this point you’ll be able to run the development server and run Im3nsa. It will be available at
$ python manage.py runserver
Testing with the Im3nsa SMS Channel Android app
Configure to connect to your development server
There is a hidden feature of the Im3nsa SMS Channel Android app for testing your Im3nsa development instance on a local network.
If you tap the Im3nsa logo in the app 11 times you can unlock the advanced settings, which will let you enter any an IP address. The app will attempt to connect to Im3nsa using the given IP address on port 8000 so you can claim the relayer and test sending/receiving with real SMS messages. If you need to use a different port, you can append it to the IP address like:
Android only allows a single app to send a certain number of messages per hour. However, you can increase your message throughput by installing “SMS Channel Pack” apps, which effectively raise the allowed number of messages for the Im3nsa SMS Channel Android app. .