Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Flask-REST-Controller is added Class-Based-View(Controller) extension on Flask

Project description

Flask-REST-Controller is added Class-Based-View(Controller) extension on Flask


  • Follow the RESTful design
  • provide of prepare authentication and request validation
    • other class based view library is not provided of validation
  • uniform routing management
    • The existing functional view is difficult to manage. Definition routing Scattered
  • JSON Response Validation with JSON Schema
    • It would be useful for creating an API :)


$ pip install flask-rest-controller


from flask import Flask
from flask_rest_controller import Controller, set_routing

app = Flask(__name__)
app.secret_key = '͏?Š|?    èg<Î|ÇæãhŽÖúÈi|î°'

class JsonController(Controller):
    schema = {
        'GET': {
            'type': 'array',
            'properties': {
                'id':   {
                    'type': 'string'
        'POST': {
            'type': 'object',
            'properties': {
                'result':   {
                    'type': 'string'
                'code': {
                    'type': 'integer'

    def get(self):
        return self.render_json(["Hello World"])

    def post(self):
        return self.render_json({'result': "ok", 'code': 200})

    ("/", "app.JsonController", "json_controller"),

set_routing(app, ROUTING)

if __name__ == "__main__":

Just save it as and try

$ python

Now head over to, and you should see your hello world of json string

You should see a post request result, try this command

$ curl --request POST

You should see that you json in the post method

see For other examples


  • Python2.6 later
  • jsonschema


  1. Fork it
  2. Create your feature branch (git checkout -b your-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin your-new-feature)
  5. Create a new Pull Request


  • MIT

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node

History Node

History Node

History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
Flask-REST-Controller-1.0.0.tar.gz (6.0 kB) Copy SHA256 hash SHA256 Source None Jul 5, 2015

Supported by

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