Flask Blueprint code to find the distance from the Moscow Ring Road to a specified address
setting the code is done in two steps:
Replace the values in .env :
FLASK_APP
: Entry point of your application; should bewsgi.py
.FLASK_ENV
: The environment in which to run your application; eitherdevelopment
orproduction
.SECRET_KEY
: Randomly generated string of characters used to encrypt your app's data.LESS_BIN
(optional for static assets): Path to your local LESS installation viawhich lessc
in linux or in windows install LESS with npm and set it to npm\lessc.cmd.ASSETS_DEBUG
(optional): Debug asset creation and bundling indevelopment
.LESS_RUN_IN_DEBUG
(optional): Debug LESS while indevelopment
.COMPRESSOR_DEBUG
(optional): Debug asset compression while indevelopment
.
Remember never to commit secrets saved in .env files to Github.
to deploy the server run these commands(dependencies version might differ from operating system):
$ git clone https://github.com/djidan10/flask-blueprint-task.git
$ cd flask-blueprint-tutorial
$ python3 -m venv .venv
$ venv\Scripts\activate
$ python3 -m pip install --upgrade pip
$ pip install -r requirements.txt
$ python3 wsgi.py
Note that the path for the virtual environment(venv\Script\activate) depends on the operating system
The code was experimented on Windows10 with Python 3.9.6 using Pycharm 2020.2
Thanks to Hackers and Slackers for their tutorials ![Flask Blueprint Tutorial] the core of the solution is inspired from their github https://github.com/hackersandslackers/flask-blueprint-tutorial/
running the application brings you here, to obtain the results, do ::
- 1 - type a correct address.
- 2 - click on the calculate button
- 3 - results will be displayed on the map and on the bottom part of the page (the blue region is the MKAD, the red pin is the localisation of the address typed and, the blue one is the cloosest corner of the MKAD with the inpput address).
- 4 - if the location is inside the MKAD it will display this message in the bottom,
if the user type something bad or not meaningful for the Yandex Geocoder API , it will shows a problem message in the top
- 1 - type a bad address.
- 2 - click on the calculate button
- 3 - an error message will be displayed on the top to check the input data