All Projects → gitgik → flask-rest-api

gitgik / flask-rest-api

Licence: MIT license
A flask-driven RESTful API for Bucketlist interactions

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
Mako
254 projects

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

    git clone [email protected]:gitgik/flask-rest-api.git
  • Dependencies

    1. Cd into your the cloned repo:

      cd flask-rest-api
    2. Create and get into your virtual environment:

      virtualenv -p python3 venv
      source venv/bin/activate
  • Environment Variables

    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.

  • Install your requirements

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

    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
  • Running the Server

    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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].