-
Notifications
You must be signed in to change notification settings - Fork 7
Install personal dev environment
Here is a much shorter document, than this, showing how to quickly get siptrack up and running in a small personal environment for testing or development.
This guide was last tested on CentOS 7 with Python 2.7.5.
$ sudo yum install openssl-devel gcc libffi-devel openldap-devel mariadb-devel python-virtualenv git pwgen
$ mkdir venv
$ virtualenv venv/siptrack
$ . venv/siptrack/bin/activate
$ git clone https://github.com/sii/siptrack
$ git clone https://github.com/sii/siptrackd
$ git clone https://github.com/sii/siptrackweb
$ cd siptrack
$ python setup.py install
$ cd ..
$ cd siptrackd
$ pip install -r requirements.txt
$ python setup.py install
First you can test it in the foreground like this.
$ ./siptrackd -l - -b stsqlite -s storage.cfg --searcher=whoosh \
--searcher-args=/tmp/whoosh-index
Then run it as a daemon like this.
$ ./siptrackd -l siptrackd.log -d -b stsqlite -s storage.cfg \
--searcher=whoosh --searcher-args=/tmp/whoosh-index
Example of storage.cfg:
[mysql]
hostname=local.db.server
username=siptrack
password=secret password.
dbname=siptrack_test
[sqlite]
filename=./st.sqlite3
Assuming you have a sql server on localhost, a user named siptrack with access to a database called siptrack_dev.
Copy storage.cfg to storage_dev.cfg and add your DB info to it like this.
[mysql]
hostname=localhost
username=siptrack
password=secret password.
dbname=siptrack_dev
Run siptrackd like this from the siptrackd directory.
$ ./siptrackd -l - -b stmysql -s storage_dev.cfg --searcher=whoosh \
--searcher-args=/tmp/whoosh-index
$ cd siptrackweb
$ pip install -r requirements.txt
$ python setup.py install
$ django-admin startproject stweb
$ cd stweb
Edit the following in the file stweb/settings.py.
SIPTRACK_SERVER = 'localhost'
SIPTRACK_USE_SSL = False
ADMINS = (
'[email protected]'
)
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'siptrackweb'
TIME_ZONE = 'Europe/Copenhagen'
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'siptrackweb',
)
Also remove the line about CSRF middleware from MIDDLEWARE_CLASSES.
MIDDLEWARE_CLASSES = (
...
#'django.middleware.csrf.CsrfViewMiddleware',
...
)
Then edit stweb/urls.py so it contains the following.
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'', include('siptrackweb.urls')),
]
Now create the database, and run the dev-server.
$ python manage.py migrate
$ python manage.py runserver
Now go to http://localhost:8000/ and login as user admin, password admin.