Code for Life
Search…
Common Setup
Common working environment setup for all the repositories.
All the repositories are Python and Django based, so you need to get Python set up. The following section provides a step-by-step guide to setting up your working environment. If you bump into any issue, please check our Common Issues section first for help.

Python installation

First, check whether you've got Python installed:
1
python --version
Copied!
We are currently on Python 3.7.x.

Python versions with pyenv

If you don't have Python 3.7, we'd highly recommend using pyenv to manage multiple versions of Python.
Please follow the installation instruction for your OS.
Check your pyenv installation:
1
pyenv versions
Copied!
Install the required python version: (this process may take a while)
1
pyenv install 3.7.10
Copied!
At the point of writing, we are using either 3.7.9 or 3.7.10. Feel free to try the latest patch version of 3.7 if a new one has come up.
Switch pyenv to using the 3.7.x:
1
pyenv global 3.7.10
Copied!
This tells your system and the next steps in this page to use the selected Python version. You can double check by running pyenv versions again. The star * sign shows the selected version.
You can switch back to other Python version if you need to later. We use this Python version to build our virtual environment with pipenv in the next steps. Once the virtual environment is built, we don't need pyenv anymore.

sqlite3 (Mac only)

If you're on Mac, you may have an old or incompatible sqlite3 version, and it's recommended to first upgrade your sqlite3 and follow the next steps. Otherwise, you can skip ahead.
Upgrade sqlite3 with brew install sqlite3. Then follow the instructions in brew info sqlite3 e.g.
1
If you need to have sqlite first in your PATH, run:
2
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc
3
​
4
For compilers to find sqlite you may need to set:
5
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
6
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
Copied!

pip - Python package management

Next up, you need to have pip. pip is Python standard package management system, used to install and manage software packages.
On Mac, pip should come with your Python installation.
On Ubuntu, run sudo apt-get install python3-pip.
Check that you've got pip installed:
1
pip --version
Copied!

pipenv - Python virtual environment

Next, install pipenv. pipenv creates and manages virtual environment for the project. It installs and removes packages from the Pipfile in an isolated working environment, so it doesn't mess with your system.
On Mac, run brew install pipenv.
On Ubuntu, run sudo pip install pipenv.

Clone the repo

Please follow our Development Guidelines for the detail on how to clone or fork a repository.

Build and activate the virtual environment

Once you have the repo locally, cd into the folder, and run:
1
pipenv install --dev
Copied!
This builds the virtual environment for the project. The process may take a few minutes.

Activate the virtual environment

If you've done everything right, all the steps above only have to be done once. And this is the point where you need to start when you leave and come back, or start a new shell.
In the directory of the repo, run:
1
pipenv shell
Copied!
This activates the virtual environment for this repo. Depending on your shell, you should see the difference in the shell prompt when you're inside a virtual environment.

Run the web server

Finally, inside the folder, run:
1
./run
Copied!
This command will:
    sync the database
    collect the static files
    run a development web server
You should see output like the following:
1
Django version 2.2.20, using settings 'settings'
2
Starting development server at http://127.0.0.1:8000/
3
Quit the server with CONTROL-C.
Copied!
At this point the portal will be accessible with your browser at http://localhost:8000/.
The steps above are the same for all three repositories and the minimum to get the portal running. aimmo has some extras as it uses kubernetes and minikube so please check the aimmo setup for more detail.
Please do not hesitate to ask questions if you found any difficulties to get things up and running. Github Discussion is the perfect place for this. It is monitored by the core developers and your questions may help other contributors who bump into the same issues.
​
Last modified 3mo ago