A flask-driven restful API for Bucketlist interactions
- Python3 - A programming language that lets you work more quickly (The universe loves speed!).
- Flask - A microframework for Python based on Werkzeug, Jinja 2 and good intentions
- Virtualenv - A tool to create isolated virtual environments
- PostgreSQL – Postgres database offers many advantages over others.
- Minor dependencies can be found in the requirements.txt file on the root folder.
If you wish to run your own build, first ensure you have python3 globally installed in your computer. If not, you can get python3 here.
After this, ensure you have installed virtualenv globally as well. If not, run this:
pip install virtualenv
Git clone this repo
git clone [email protected]:gitgik/flask-rest-api.git
Cd into your the cloned repo:
cd flask-rest-apiCreate and get into your virtual environment:
virtualenv -p python3 venv source venv/bin/activate
Install Dotenv as follows:
pip install python-dotenv
Create a .env file and add the following:
SECRET="some-very-long-string-of-random-characters-CHANGE-TO-YOUR-LIKING" APP_SETTINGS="development" DATABASE_URL="postgresql://localhost/flask_api"
Dotenv will load your environment variables by reading the key-value pairs from the .env file.
(venv)$ pip install -r requirements.txt
Make sure your postgresql server is running. Then, on your psql console, create your database:
$ psql -U postgres > CREATE DATABASE flask_api;
In the project directory, make and apply your Migrations
(venv)$ flask db init (venv)$ flask db migrate
And finally, migrate to persist them on the database
(venv)$ flask db upgrade
On your terminal, run the server using this one simple command:
(venv)$ flask run
You can now access the app on your local browser by using
http://localhost:5000/bucketlists/
Or test creating bucketlists using Postman