alexandre-mbm / osm-tasking-manager2

Openshift = Tasking Manager em 4 minutos! Leia a wiki e saiba mais....
Other
0 stars 0 forks source link

OpenStreetMap Tasking Manager

Build Status Coverage Status

About

OSMTM enables collaborative work on specific areas in OpenStreetMap by defining clear workflows to be achieved and by breaking tasks down into pieces.

The application is written in Python using the Pyramid framework.

This is the 2.0 version of the Tasking Manager.

Installation

First clone the git repository:

git clone --recursive git://github.com/hotosm/osm-tasking-manager2.git

Installing OSMTM in a Virtual Python environment is recommended.

To create a virtual Python environment:

cd osm-tasking-manager2
sudo easy_install virtualenv
virtualenv --no-site-packages env
./env/bin/python setup.py develop

Tip: if you encounter problems installing psycopg2 especially on Mac, it is recommended to follow advice proposed here.

Database

OSMTM requires a PostgreSQL/PostGIS database. Version 2.x of PostGIS is required.

First create a database user/role named www-data:

sudo -u postgres createuser -SDRP www-data

Then create a database named osmtm:

sudo -u postgres createdb -O www-data osmtm
sudo -u postgres psql -d osmtm -c "CREATE EXTENSION postgis;"

 Local settings

You certainly will need some local specific settings, like the db user or password. For this, you can create a local.ini file in the project root, where you can then override every needed setting. For example:

[app:main]
sqlalchemy.url = postgresql://www-data:www-data@localhost/osmtm

Note: you can also put your local settings file anywhere else on your file system, and then create a LOCAL_SETTINGS_PATH environment variable to make the project aware of this.

Populate the database

You're now ready to do the initial population of the database. An initialize_osmtm_db script is available in the virtual env for that:

./env/bin/initialize_osmtm_db

Launch the application

./env/bin/pserve --reload development.ini

You will see messages, hopefully including a line like serving on http://0.0.0.0:6543. Visit that address in your web browser - you should see your local Tasking Manager!

Styles

The CSS stylesheet are compiled using less. Launch the following command as soon as you change the css:

lessc -ru osmtm/static/css/main.less > osmtm/static/css/main.css

Launch the application

env/bin/pserve --reload development.ini

Tests

The tests use a separate database. Create that database first:

sudo -u postgres createdb -O www-data osmtm_tests
sudo -u postgres psql -d osmtm_tests -c "CREATE EXTENSION postgis;"

Create a local.test.inifile in the project root, where you will add the settings for the database connection. For example:

[app:main]
sqlalchemy.url = postgresql://www-data:www-data@localhost/osmtm_tests

To run the tests, use the following command:

./env/bin/nosetests

Application deployment

  1. pull latest updates from the repository: git pull origin
  2. update the submodules: git submodule update
  3. update/install python modules: python setup.py develop
  4. create database dump: pg_dump -Fc -f osmtm2_latest.dmp database_name
  5. run database migrations: alembic upgrade head
  6. compile messages: python setup.py compile_catalog
  7. restart application server

Customization

In case you install your own instance you may want to customize its look and feel. You can do so by modifying the following files: osmtm/templates/custom.mako, osmtm/static/css/custom.less & osmtm/static/img/favicon.ico

Localization

OSMTM is localized on https://www.transifex.com/projects/p/osm-tasking-manager2/ service.

It's possible to create translations for two resources: current and master. Current resource represents currently deployed instance of the OSMTM [http://tasks.hotosm.org](). Master resource represents actively developed code that will become current once it gets deployed.

Initializing translation files

In general managing translation files involves:

Using Transifex service

Example .transifexrc file:

[https://www.transifex.com]
hostname = https://www.transifex.com
password = my_super_password
token =
username = my_transifex_username

Setting up resources

Pulling changes

Transifex workflow

Updating source files, locally and on the service

Pull latest changes from the service