Skip to content
A flask-driven restful API for Bucketlist interactions
Python Shell Mako
Branch: master
Clone or download
Latest commit e70250d Nov 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app [chore] add habitat init and run scripts May 28, 2017
habitat edit plan.sh Jun 3, 2017
instance [chore] refactor tests to use a simpler way to get the id from result… Apr 30, 2017
migrations [fix] use email instead of username Apr 30, 2017
results [chore] refactor plan.sh to use a better build process May 29, 2017
tests [chore] change all occurences of log in to login May 2, 2017
.coveragerc [chore] add coverage config file Apr 23, 2017
.gitignore git ignore the environment May 29, 2017
.travis.yml [chore] add coveralls in travis Apr 30, 2017
LICENSE Initial commit Apr 17, 2017
README.md
manage.py [chore] document manage.py May 8, 2017
requirements.txt update psycopg Nov 13, 2019
run.py [feature] define bucketlist model Apr 19, 2017

README.md

flask-rest-api Build Status

A flask-driven restful API for Bucketlist interactions

Technologies used

  • 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.

Installation / Usage

  • 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 to your PC

        $ git clone git@github.com:gitgik/flask-rest-api.git
    
  • Dependencies

    1. Cd into your the cloned repo as such:

      $ cd flask-rest-api
      
    2. Create and fire up your virtual environment in python3:

      $ virtualenv -p python3 venv
      $ pip install autoenv
      
  • Environment Variables

    Create a .env file and add the following:

    source venv/bin/activate
    export SECRET="some-very-long-string-of-random-characters-CHANGE-TO-YOUR-LIKING"
    export APP_SETTINGS="development"
    export DATABASE_URL="postgresql://localhost/flask_api"
    

    Save the file. CD out of the directory and back in. Autoenv will automagically set the variables. We've now kept sensitive info from the outside world! 😄

  • Install your requirements

    (venv)$ pip install -r requirements.txt
    
  • Migrations

    On your psql console, create your database:

    > CREATE DATABASE flask_api;
    

    Then, make and apply your Migrations

    (venv)$ python manage.py db init
    
    (venv)$ python manage.py db migrate
    

    And finally, migrate your migrations to persist on the DB

    (venv)$ python manage.py db upgrade
    
  • Running It

    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

You can’t perform that action at this time.