Frameworks68k+ stars

Flask

A micro web framework for Python

Commit Details

Message
"Initial commit of the flask app"
Author
Armin Ronacher
Date
2010-04-01
Hash
6a92cf5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a

Fun Fact

Flask started as an April Fools' joke in 2010! Armin combined Werkzeug and Jinja2, and the joke became incredibly popular.

</>First Code

Python
# -*- coding: utf-8 -*-
"""
    flask
    ~~~~~

    A micro web framework for Python.
    
    :copyright: (c) 2010 by Armin Ronacher.
    :license: BSD
"""

from werkzeug import Request, Response

class Flask:
    def __init__(self, name):
        self.name = name
        self.routes = {}
    
    def route(self, path):
        def decorator(f):
            self.routes[path] = f
            return f
        return decorator
    
    def run(self, host='localhost', port=5000):
        from werkzeug import run_simple
        run_simple(host, port, self)