Go to file
2018-09-26 15:07:56 +00:00
apps Fix failing test 2018-09-26 15:09:35 +01:00
bin Update lots of things 2017-06-16 18:10:44 +02:00
ojusomap Selenium test is now working 2018-09-26 16:05:03 +01:00
support Translated using Weblate (English (United Kingdom)) 2018-05-26 06:54:03 +00:00
traefik Add traefik config 2018-04-19 11:56:15 +00:00
.dockerignore Update .*ignore files to exclude envars 2017-05-21 01:54:15 +02:00
.gitignore Ignore static dir in git 2018-09-26 15:09:35 +01:00
.gitlab-ci.yml Update .gitlab-ci.yml 2018-09-26 14:21:44 +00:00
docker-compose.yml Add missing MEMCACHED_HOST to fix Weblate 2018-04-23 01:57:28 -04:00
Dockerfile Add registration and login templates plus UI stuff, moderation 2017-10-08 21:21:51 +01:00
environment.sh Add registration and login templates plus UI stuff, moderation 2017-10-08 21:21:51 +01:00
environment.template Use MailGun via django-anymail instead of Gandi 2018-04-03 17:46:04 -04:00
example.env Update docs, add example .env file 2018-09-26 15:09:35 +01:00
local.env Add registration and login templates plus UI stuff, moderation 2017-10-08 21:21:51 +01:00
local.yml Don't run collectstatic for every. single. change 2018-03-29 01:21:54 -04:00
manage.py Add Django project and nginx conf + deps 2017-05-18 23:51:17 +02:00
ojuso-logo.svg Add the ojuso logo as a simplified SVG 2018-04-15 22:55:43 +10:00
README.md More detailed psycopg troubleshooting instructions 2018-09-26 15:09:35 +01:00
requirements-devel.txt Include selenium in requirements 2018-06-20 00:10:32 -04:00
requirements-test.txt Include selenium in requirements 2018-06-20 00:10:32 -04:00
requirements.txt Drop -e from django-cas-server install 2018-09-26 15:09:35 +01:00
setup.cfg Try again 2018-09-26 15:09:35 +01:00
system-requirements-debian.txt Updated documentation and system requirements 2018-09-26 15:09:35 +01:00
system-requirements-fedora.txt Update setup instructions 2018-09-26 15:09:35 +01:00

Translation pipeline status coverage report

ojuso-map

Kickass map for the Ojuso Project

Getting Started

(These instructions are for GNU/Linux. Running this application on other platforms will probably work.. good luck!)

Check out the code

$ git clone git@gitlab.com:autonomic-cooperative/ojuso-map.git
$ cd ojuso-map

All commands from here on should be run in the ojuso-map directory.

Install System Dependencies

Debian / Ubuntu

$ xargs < system-requirements-debian.txt sudo apt-get install -y

Fedora

$ xargs < system-requirements-fedora.txt sudo dnf install

If you hadn't previously installed Postgres, you will need to initialise the database and start the server:

$ sudo postgresql-setup --initdb --unit postgresql
$ sudo systemctl start postgresql

Set up the Python environment

It is highly recommended to use a Python "virtual environment", which lets you install a separate parallel set of packages for each app you're working on. As an example:

$ pip list | grep Django
$ source .venv/bin/activate
$ pip list | grep Django
Django                    1.11.6 
$ deactivate
$ pip list | grep Django
$ 

See the virtualenv documentation for full instructions

Follow the virtualenvwrapper installation instructions to set it up, then create a new virtual environment and install dependencies in one step with:

$ mkvirtualenv -a . -p /usr/bin/python3 -r requirements-devel.txt ojuso-map

Then, edit the postactivate script:

$ $EDITOR $VIRTUAL_ENV/bin/postactivate

and add a cheeky line to automatically load environment variables (see below):

source `cat $VIRTUAL_ENV/.project`/.env

Manual

Set up your Python virtual environment in the .venv folder:

$ python3 -m venv .venv
$ source .venv/bin/activate

Then install python dependencies:

$ pip3 install --upgrade pip setuptools
$ pip3 install -r requirements-devel.txt

Initialise and load configuration

Copy example.env to .env. If you're using virtualenvwrapper, this file will now be loaded every time you run workon ojuso-map (to reload it after changes, run deactivate && workon ojuso-map). Otherwise, you'll need to load it manually with e.g.

$ source .env

or using direnv (in which case you should call your file .envrc) or autoenv.

Set up database

You need to configure Postgres to allow password (it calls it md5) authentication, and set up a user with superuser privileges on a database.

Follow these instructions to change the Postgres authentication options (NB on Fedora / Centos, pg_hba.conf is located in /var/lib/pgsql/data), then connect to the database:

$ psql -U postgres

(you may need sudo -u postgres psql depending on your security configuration)

Now, either set a password on the postgres user:

postgres=# ALTER USER postgres WITH PASSWORD 'postgres';

or create a new user account and database:

postgres=# CREATE DATABASE ojuso;
postgres=# CREATE USER ojuso WITH PASSWORD 'ojuso'; 
postgres=# ALTER ROLE ojuso SET client_encoding TO 'utf8'; // this is recommended for django
postgres=# ALTER ROLE ojuso SET default_transaction_isolation TO 'read committed'; // so is this
postgres=# GRANT ALL PRIVILEGES on database ojuso to ojuso;
postgres=# ALTER USER ojuso with superuser;  

Type \q to exist the postgres shell.

If you chose the second option, edit your specific database name, username and password into your .env file.

Run The Migrations

$ python manage.py migrate

Start the server

$ python manage.py runserver

(Use Ctrl+C to stop the server)

Resuming work

After shutting down the server / restarting your computer / etc., you will need to run some things to get going again.

With virtualenvwrapper;

$ workon ojuso-map
$ python manage.py runserver

or if you followed "Manual" instructions above:

$ cd ojuso-map
$ source .venv/bin/activate
$ python manage.py runserver

(and $ source .env if you're not using auotenv or direnv)

Running The Tests

$ pip install -r requirements-test.txt
$ python manage.py collectstatic
$ pytest -v

Troubleshooting

Sometimes, you see crashes like the following with psycopg:

django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module:
$USER/.virtualenvs/ojuso-map/lib/python3.6/site-packages/psycopg2/.libs/libresolv-2-c4c53def.5.so:
symbol __res_maybe_init version GLIBC_PRIVATE not defined in file libc.so.6 with
link time reference

In which case the following can help:

$ pip3 uninstall psycopg2 && pip3 install --no-binary :all: psycopg2