Online Project Documentation
Interactive documentation is available at http://opentraincommunity.readthedocs.org/en/latest/
- Python 3.6
- Postgres (dumps postgres 10)
Our server (otrain.org) runs with ubuntu 18.04, postgres 10 and python 3.6.7
Developer Environment Setup
The project runs on Python 3 with POSTGRES, and we recommend using a virtual environment for development. You can use the following command to setup a virtualenv called
mkvirtualenv -p $(which python3) opentrain
You might need to first install the virtualenv package, via:
sudo pip install virtualenv
Then activate the environment:
cd opentrain source bin/activate
Then install all of the required modules into your virtualenv using
cd OpenTrainCommunity/train2 pip install -r requirements.txt
Note: Installation of numpy via pip might require fulfilling certain prerequisites.
sudo apt-get install postgresql libpq-dev
Database setup and import
Best way to start is to download the POSTGRES dump file.
- Download the latest sql dump from http://otrain.org/files/dumps/ (you can download the gz file)
python restore.py <name-of-sql-file>
Note that the script will gunzip the file. You might need to run,
pip install argparse
In case you have already set a postgres user name, you could face:
ERROR: role "postgres" does not exist
In this case, create a user name postgres before running the script.
On mac platform you might also have to change l29 in clean_all.py to
postgres_cmd = "sudo -u your_macuser psql"
Alternativley, you can use fab and run the following commands:
fab create_db fab restore_db:<path-to-sql-gz-file>
Now you can start the server.
python manage.py runserver
ln -s /usr/include/locale.h /usr/include/xlocale.h
If you receive the error
symbol __res_maybe_init version GLIBC_PRIVATE not defined in libc.so.6 with link time reference, it is likely due to a psycopg bug and can likely be solved by upgrading psycopg2 to a later version like 18.104.22.168.