ramojo / landmatrix

The Land Matrix is a global and independent land monitoring initiative that promotes transparency and accountability in decisions over land and investment. The website is our Global Observatory - an open tool for collecting and visualising information about large-scale land acquisitions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation

  1. Install system packages (Debian)
$ sudo apt-get install postgresql-9.4-postgis-scripts postgresql-9.4-postgis-2.1 postgresql-9.4 postgresql-client-9.4 postgresql-contrib-9.4 \
                 virtualenvwrapper python3-psycopg2 libpq-dev npm
  1. Setup a virtual environment for Python3.4 including the postgres driver (Virtualenv):
$ mkvirtualenv landmatrix --system-site-packages -p /usr/bin/python3.4
$ workon landmatrix
  1. Install Django requirements (PIP):

If you intend to do ANY development on the frontend/backend, use the requirements-dev.txt in the next step, it will include the default requirements.txt:

$ pip install -r requirements.txt
  1. Set up the database, user and postgis (Init script):
$ ./init.sh
  1. Create settings file and adapt database settings:
$ cp landmatrix/settings.py.dist landmatrix/settings.py
  1. Run database migrations:

After the database is ready, Run the migrations - just to make sure:

$ python manage.py migrate
  1. Install frontend dependencies (Bower):
$ sudo npm -g install bower
$ bower install

If you intend to develop on the frontend, you'll probably want livereload:

$ npm install gulp gulp-livereload  gulp-watch
  1. Compile CSS and collect static files:
$ python manage.py compilescss

This will generate a "main.css" which should already be included in the repository. You'll mostly need this to regenerate after changes to the CSS.

Then collect the static files (CSS, Javascript and images):

$ python manage.py collectstatic
  1. Run the server:
$ python manage.py runserver

Manage commands

Checks if the given export file (XLSX) has any errors (for internal QA).

$ python manage.py check_export

Checks why deal is not public.

$ python manage.py get_not_public_reason

Populates the countries with shape geometries (from biogeo.ucdavis.edu)

$ python manage.py load_country_geometries

Populates the activities with common used attributes. This command is run by a CronJob on the production system.

$ python manage.py populate_activities

Populates the country bounding boxes for zooming in the map.

$ python manage.py populate_countries

Updates all documents within the elasticsearch index. This command is run by a CronJob on the production system. It is recommended to run populate_activities before.

$ python manage.py update_elasticsearch

Structure and Apps schema

  • api: App providing all views for the API
  • charts: App providing all views for the Charts section
  • docs: Make files for landmatrix.readthedocs.io
  • editor: App prodiving all views for the Editor section
  • feeds: App providing RSS/Atom feeds for activities
  • from_v1: Migration scripts for the old database
  • grid: App providing all views for the Grid (or Data) section
  • landmatrix: Django main application folder including settings.py file
  • locale: Django translation files (maintained by: manage.py makemessages/compilemessages)
  • map: App providing all views for the Map section
  • media: Django media folder for user uploads (e.g. in CMS)
  • notifications: App providing email notifications
  • ol3_widgets: App providing OpenLayers 3 widgets
  • public_comments: App providing threaded comments
  • static: Django static folder, for CSS, Javascript and image files used by the frontend
  • templates: Django template folder
  • wagtailcms: App providing the CMS
  • manage.py: Django manage project script
  • requirements.txt: Required python packages for PIP command
  • fabfile.py: Configuration files for deployment using Fabric

API

The API documentation can be found at https://dev.landmatrix.org/api/

Tests

The projects includes integration and unit tests. The tests are run using django-nose in the background. The following command runs the test cases:

$ python manage.py test

About

The Land Matrix is a global and independent land monitoring initiative that promotes transparency and accountability in decisions over land and investment. The website is our Global Observatory - an open tool for collecting and visualising information about large-scale land acquisitions.

License:GNU Affero General Public License v3.0


Languages

Language:Python 73.6%Language:JavaScript 9.7%Language:HTML 8.9%Language:CSS 7.7%Language:Shell 0.2%