Skip to content

Set up local environment

Mads Nedergaard edited this page Nov 5, 2021 · 30 revisions

Setup Python development environment

  1. Ensure you are using Python 3.6 or Python 3.7 (We recommend using pyenv to handle different Python versions.)

  2. Ensure you have the dependency management tool Poetry installed by this guide. The easiest is to do pip install poetry

  3. From the root folder, install the dependencies in a virtual environment:

    poetry install -E parsers
    

You can now run a few different commands:

poetry run lint # linting
poetry run test # run unit tests

You might need to have zlib and libjpeg installed on your machine.

Having problems?

First up, make sure you're using Python 3.7 (or 3.6).

If it's still not working, please create an issue where you include the output from poetry debug so that we can help debug it.

Running the frontend map

  1. Install docker

  2. First, you need to compile the frontend. Open a terminal in the root directory and run:

    docker-compose build
    
  3. Start the application by running:

    docker-compose up
    

    This will watch over source file changes, run nonstop and watch changes you make in the code to recompile the frontend if needed.

  4. Go to http://localhost:8000/ and you should now see the map!

Notes:

  • These steps only build with the English language (which will be faster as not all languages need to be built). To build all languages, change the command of the web-watch-en section of docker-compose.yml from command: npm run watch-en to command: npm run watch.
  • The backend handles the calculation of carbon emissions. The map data displayed comes from a mock server providing dummy data from the state file.

See Troubleshooting for common issues and fixes when building the map locally.

Clone this wiki locally