This repository contains the code for this blogpost.
Kindly ensure you have the following installed:
-
Clone the repo:
$ git clone https://github.com/ro6ley/cars_in_a_flask.git $ cd cars_in_a_flask
-
With Python 3.6 and Pip installed:
$ virtualenv --python=python3 env --no-site-packages $ source env/bin/activate $ pip install -r requirements.txt
-
Create a PostgreSQL user with the username and password
postgres
and create a database calledcars_api
:$ createuser --interactive --pwprompt $ createdb cars_api
-
Export the required environment variables:
$ export FLASK_APP=app.py
-
Execute the migrations to create the
cars
table:$ flask db migrate $ flask db upgrade
-
Run the Flask API:
$ flask run
-
Navigate to
http://localhost:5000/cars
to view the cars data.
Please feel free to raise issues using this template and I'll get back to you.
You can also fork the repository, make changes and submit a Pull Request using this template.