• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Class based views for Flask

Flask-Classful

Flask-Classful is an extension that adds class-based views to Flask. Class-based views are a way to encapsulate specific context and behavior for routes and methods, complementing Flask's blueprints. They provide a more powerful system than Flask's own MethodView.

Read the documentation at https://flask-classful.readthedocs.io.

Pallets Community Ecosystem

Important
This project is part of the Pallets Community Ecosystem. Pallets is the organization that maintains Flask; Pallets-Eco enables community maintenance of Flask extensions. If you are interested in helping maintain this project, please reach out on the Pallets Discord server.

A Basic Example

This example defines a few routes by defining methods on a subclass of flask_classful.FlaskView.

# example.py
import random
from flask import Flask, abort
from flask_classful import FlaskView

quotes = [
    "A noble spirit embiggens the smallest man! ~ Jebediah Springfield",
    "If there is a way to do it better... find it. ~ Thomas Edison",
    "No one knows what he can do till he tries. ~ Publilius Syrus"
]

app = Flask(__name__)

class QuotesView(FlaskView):
    def index(self):
        return "<br>".join(quotes)

    def get(self, id):
        id = int(id)

        if id < len(quotes):
            return quotes[id]

        abort(404)

    def random(self):
        return random.choice(quotes)

QuotesView.register(app)
$ flask -A example run --debug

Forked from Flask-Classy

Note
This is a fork of Flask-Classy to continue development after it was not updated for a long time.

More Repositories

1

flask-sqlalchemy

Adds SQLAlchemy support to Flask
Python
4,134
star
2

blinker

A fast Python in-process signal/event dispatching system.
Python
1,647
star
3

flask-debugtoolbar

A toolbar overlay for debugging Flask applications
JavaScript
912
star
4

flask-caching

A caching extension for Flask
Python
882
star
5

flask-security

Quick and simple security for Flask applications
Python
625
star
6

flask-mail

Flask-Mail adds SMTP mail sending to your Flask applications
Python
595
star
7

flask-jwt

JWT (JSON Web Tokens) for Flask applications
Python
563
star
8

flask-principal

Identity management for Flask applications
Python
494
star
9

flask-session

Server side session extension for Flask
Python
477
star
10

flask-social

OAuth Provider Integration for Flask-Security
Python
245
star
11

flask-openid

Flask-OpenID adds openid support to flask applications
Python
234
star
12

flask-rq

RQ (Redis Queue) integration for Flask applications
Python
217
star
13

cachelib

Extract from werkzeug.cache
Python
131
star
14

flask-jsonschema

JSON request validation with jsonschema for Flask applications
Python
64
star
15

flask-alembic

Integrate Alembic with Flask.
Python
43
star
16

secure-cookie

Secure cookies and sessions for WSGI
Python
32
star
17

flask-environments

Environment tools and configuration for Flask applications
Python
30
star
18

flask-negotiate

Content negotiation for Flask apps
Python
12
star
19

flask-stache

Mustache templates for Flask apps
Python
10
star
20

flask-orjson

A Flask/Quart JSON provider using the fast orjson library.
Python
8
star
21

click-bash4.2-completion

Support Bash 4.2 completion for Click 8.0.x
Python
2
star
22

.github

2
star
23

flask-ujson

A Flask/Quart JSON provider using the fast ujson library.
Python
2
star
24

flask-api-examples

1
star