The example webmap application uses Flask along with Folium to geocode a given location (using geopy via Mapbox or Nominatim) and display the result as a LeafletJS map.
❗ Before running a new .env
file should be created following the .env.example
file.
On a local machine, a new virtualenv can be created and the debug version of the app can ran as follows:
conda create -n flaskwebapp python=3.7
pip install -r requirements.txt
python run.debug.py
Alternatively the containerised version, which uses the Bjoern WSGI server can be launched as follows:
# apt-get install libev-dev
./scripts/build && ./scripts/run
Once either of these is running, browse to the application: http://0.0.0.0:5000
For local development, pre-commit should be installed and the application can be installed as editable along with the dev requirements:
pre-commit install
pip install -e .
pip install -r requirements-dev.txt
- Pytest is used for the functional tests of the application (see
/tests
). - Code is linted using flake8 with
--max-line-length=120
- Code formatting is validated using Black
- pre-commit is used to run these checks locally before files are pushed to git
- The Github Actions pipeline also runs these checks and tests
Deployment to AWS is handled by the AWS Cloud Development Kit (CDK) using AWS Elastic Container Service (ECS). All code is in /infra
.
However as this an is a simple standalone container, AWS copilot was previously used for initial deployment. It could also be used for production deployments and to generate CI/CD pipelines. More details are in the introductory blogpost.