Skip to main content

Python Web Framework

Project description

xFlask combines the extensions of Flask and it is designed to make getting started quick and easy to build Restful web service, with the ability to scale up to complex applications. It began as a simple wrapper around Flask and its extensions to provide a simple platform to ease API development.

1. Functionalities

  • Follow concepts of Model, Data Access Object (DAO), Service and Controller
  • Ease to decouple component dependencies by using Flask-Injector
  • Provide a simple way to validate the Data Access Object by using Marshmallow
  • Adapt with Flask-Migration to easily maintain the database schema
  • Provide simple logging API helping to debug the application flow
  • Adapt with Flask-Testing for testing the application components

2. Usages

  • Model
class User(Model):

    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(50), unique=True, nullable=False)
    password = db.Column(db.String(50), unique=False, nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
  • DAO
class UserDao(Dao):

    @inject
    def __init__(self, db: SQLAlchemy):
        self.db = db

    def get_user(self, user_id):
        return User.query.get(user_id)
  • Service
class UserService(Service):

    logger = logging.getLogger(__qualname__)

    @inject
    def __init__(self, user_dao: UserDao):
        self.user_dao = user_dao

    def get_user(self, user_id):
        return self.user_dao.get_user(user_id)
  • Controller
@app.route('<user_id>')
def get_user(user_id, user_service: UserService):
    user = user_service.get_user(user_id)
    return Response.success(user.to_dict()).to_dict()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for xFlask, version 0.0.8
Filename, size File type Python version Upload date Hashes
Filename, size xFlask-0.0.8.tar.gz (15.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page