-
Notifications
You must be signed in to change notification settings - Fork 957
Set up local environment
-
Ensure you are using Python 3.6 or Python 3.7
-
Ensure you have the dependency management tool Poetry installed by this guide. The easiest is to do
pip install poetry
-
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.
-
Follow the steps mentioned in the section above to setup your Python development environment
-
From the root folder, use the
test_parser.py
command line utility:poetry shell # activate virtual environment python test_parser.py FR price # get latest price parser for France python test_parser.py FR # defaults to production if no data type is given # test a specific datetime (parser needs to be able to fetch past datetimes) python test_parser.py DE --target_datetime 2018-01-01T08:00
Many of the tests require API keys of the data or web service providers, and therefore fail with an error message like
Exception: No ENTSOE_TOKEN found! Please add it into secrets.env!
In such cases, please browse the website related to the provider and ask for an API key. Once you get hold of the API key, make it an environment variable. This fixes the error.
-
Install docker
-
First, you need to compile the frontend. Open a terminal in the root directory and run:
docker-compose build
-
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.
-
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 theweb-watch-en
section of docker-compose.yml fromcommand: npm run watch-en
tocommand: 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 below for common issues and fixes when building the map locally.
Do you have a question or an idea for improvements? Open a new discussion here