This is a simple webapp to find the nearest and cheapest gas station based on the Tankerkoenig API and the CC by 4.0 license for the IT-Talents' monthly competition. All maps in this webapp are rendered through the OpenLayers library and the frontend of this app is in german.
Click here for a working demo.
- python3
- virtualenv
- pip
These packages can be installed via pip, see installation instructions below.
- flask
- flask-sqlalchemy
- bokeh
- geocoder
-
Clone the repository:
git clone https://github.com/libeanim/refuelking.git
-
Create a virtual environment and activate it:
virtualenv -p python3 my_environment source my_environment/bin/activate
-
Use pip to install required packages in the virtual environment:
cd refuelking pip install -r requirements.txt
This is a simple explanation to run this website on a local flask test server.
-
After you finished the installation procedure, execute the
init_all.py
script in the activated virtual environment:python3 init_all.py
This will generate the configuration file and requires your Tankerkoenig api key. It also initialises a
sqlite
database in the module directory calledsample.db
-
Execute now the
run_debug.py
script to start the server:python3 run_debug.py
-
That's it! You should now be able to access the website on http://127.0.0.1:5000/.
There are many ways to deploy a Flask application. Choose your favorite or mandatory way according to your webspace provider.
Then before you start the application set the following two environment variables:
-
Set the app configuration to production mode:
export APP_CONFIG="config.ProductionConfig"
-
Set the url to your database:
export DATABASE_URL="mysql+oursql://username:password@server/database"
More information on the sqlalchemy database url format can be found here.
Hint: A working engine for mysql and python3 is
oursql
Before the first run make sure the configuration and database has been created. You can do that by executing the init_all.py
script with the correct value for the environment variable DATABASE_URL
.