GithubHelp home page GithubHelp logo

s2j1968 / flask-restful-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amansingh9097/flask-restful-boilerplate

0.0 0.0 1.0 55 KB

A minimal boilerplate for the RESTful services using Flask, SQLAlchemy and Flask-RestPlus (for the swagger-UI).

License: MIT License

Python 100.00%

flask-restful-boilerplate's Introduction

flask-restful-boilerplate

A minimal boilerplate for creating RESTful services using Flask, SQLAlchemy and Flask-RestPlus. This boilerplate has swagger-UI) [for personal use]

What it includes?

  • capabilities of establishhing connection to any database using SQLAlchemy.
  • a service logger for logging all the events, warnings, errors, etc.
  • a placeholder for declaring all your constants.
  • a placeholder for all your declared database models.
  • entire codeset is config-driven.
  • hosting of swagger-UI for your RESTful API's documentation.
  • hosting multiple namespaces in the routes.
  • a custom response generator for the payloads.

Setting up:

  • install all the requirements from requirements.txt
    pip install -r requirements.txt
  • make necessary changes in config.ini
    • add host address (default="127.0.0.1")
    • add port address (default=5000)
    • set a name for the flask restful service (default="flask-minimal-boilerplate")
    • add the database url (default="postgresql://scott:tiger@localhost/sample_db")
  • create a directory called logs in the current working directory. This is where all your log fiels will be stored.

Directory structure:

├── src
│   ├── core
|   |   ├── db_connection.py
|   |   ├── models.py
│   ├── instance
|   |   ├── config.py
|   |   ├── flask_app.py
│   ├── misc
|   |   ├── constants.py
|   |   ├── db_misc_functions.py
|   |   ├── response_generator.py
|   |   ├── service_logger.py
│   ├── routes
|   |   ├── item_1
|   |   |   ├── item_1_route_1.py
|   |   ├── item_2
|   |   |   ├── item_2_route_1.py
│   ├── namespaces.py
├── config.ini
├── requirements.txt
├── run.py

Running the program:

  • after having setup everything above, run the program using
python run.py

flask-restful-boilerplate's People

Contributors

amansingh9097 avatar dependabot[bot] avatar

Forkers

aubds

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.