Check out the repository:
git clone https://github.com/eea/eea.seris cd eea.seris
Create & activate a virtual environment:
virtualenv sandbox --no-site-packages echo '*' > sandbox/.gitignore . sandbox/bin/activate
Install dependencies. Make sure to use pip from the virtual environment:
pip install -r requirements-dev.txt
Create a configuration file:
mkdir -p instance echo 'DEBUG = True' >> instance/settings.py echo 'SECRET_KEY = "something random"' >> instance/settings.py
Set up the PostgreSQL database:
createdb seris psql seris -c 'create extension hstore' ./manage.py syncdb
Create a testing database and run the unit tests:
createdb seris_test psql seris_test -c 'create extension hstore' nosetests
Run a test server:
./manage.py runserver
Deploy (after customizing local_fabfile.py):
fab deploy
To set up the PostgreSQL database in Debian, you need to install the packages postgresql-9.1, postgresql-contrib-9.1 and postgresql-server-dev-9.1. Then create a database, enable the hstore extension, and grant access to a user:
root # su - postgres
postgres $ psql template1
psql (9.1.2)
Type "help" for help.
template1=# CREATE USER edw WITH PASSWORD 'edw';
CREATE ROLE
template1=# CREATE DATABASE seris;
CREATE DATABASE
template1=# GRANT ALL PRIVILEGES ON DATABASE seris TO edw;
GRANT
template1=# \q
postgres $ psql seris
seris=# create extension hstore;
Update the local settings:
echo 'DATABASE_URI = "postgresql://edw:edw@localhost/seris"' >> instance/settings.py
echo 'TESTING_DATABASE_URI = "postgresql://edw:edw@localhost/seris_test"' >> instance/settings.py
Seris is developed using Flask, with Jinja templates, and schema defined with Flatland. Data is stored in PostgreSQL using the special hstore column type, so there's no need for schema migration scripts on every change in the models.