Table of contents
1.
Introduction
2.
Types of Python Frameworks
2.1.
1. Django
2.1.1.
Features of Django
2.1.2.
Example of a simple Django view
2.2.
2. Flask
2.2.1.
Features of Flask
2.2.2.
Example of a simple Flask application
2.3.
3. Pyramid
2.3.1.
Features of Pyramid
2.3.2.
Example of a simple Pyramid view
2.4.
4. CherryPy
2.4.1.
Features of CherryPy
2.4.2.
Example of a Simple CherryPy Application
2.5.
5. Bottle
2.5.1.
Features of Bottle
2.5.2.
Example of a Simple Bottle Application
2.6.
6. CubicWeb
2.6.1.
CubicWeb is a semantic web framework that focuses on the organization and management of structured data. It utilizes an object-oriented data model and integrates RDF (Resource Description Framework) to handle complex data relationships. CubicWeb is designed for applications that require rich data interaction and management features.Features of CubicWeb
2.6.2.
Example of a Simple CubicWeb Application 
2.7.
7. FastAPI
2.7.1.
Features of FastAPI
2.7.2.
Example of a Simple FastAPI Application
2.8.
8. Tornado
2.8.1.
Features of Tornado
2.8.2.
Example of a Simple Tornado Application
2.9.
9. Falcon
2.9.1.
Features of Falcon
2.9.2.
Example of a Simple Falcon Application:
2.10.
10. Web2py
2.10.1.
Features of Web2py
2.10.2.
Example of a Simple Web2py Application:
3.
Frequently Asked Questions
3.1.
What is the difference between Django & Flask?
3.2.
Can Python frameworks be used for building APIs?
3.3.
Are Python frameworks suitable for real-time applications?
4.
Conclusion 
Last Updated: Aug 28, 2025
Medium

Python Frameworks List

Author Pallavi singh
0 upvote

Introduction

Python is a popular programming language which is known for its simplicity & versatility. It offers a wide range of frameworks that make web development faster & easier. Python frameworks provide a structure for building web applications and handling tasks like URL routing, database management, & user authentication. 

Python Frameworks List

In this article, we will discuss some of the most commonly used Python frameworks & their features.

Types of Python Frameworks

1. Django

Django is a high-level Python web framework that follows the Model-View-Controller (MVC) architectural pattern. It provides a rich set of features out of the box, including an admin interface, ORM (Object-Relational Mapping), authentication, & more. Django's main goal is to simplify the development process & allow developers to create complex web applications quickly.

Features of Django

  • Built-in admin interface for easy management of application data
     
  • ORM for interacting with databases using Python classes & objects
     
  • URL routing & view handling
     
  • Template engine for rendering dynamic HTML pages
     
  • Authentication & authorization system
     
  • Support for multiple databases & database migrations
     
  • RESTful API framework (Django REST Framework)

Example of a simple Django view

from django.http import HttpResponse
def hello(request):
    return HttpResponse("Hello, World!")


In this example, the `hello` function is a Django view that returns a simple "Hello, World!" response when accessed via a specific URL.

2. Flask

Flask is a lightweight & minimalistic Python web framework. It is known for its simplicity & flexibility, making it a popular choice for small to medium-sized web applications. Flask follows the micro-framework approach, providing only the essential features required for building web applications while allowing developers to choose & integrate additional libraries as needed.

Features of Flask

  • Lightweight & easy to learn
     
  • Built-in development server & debugger
     
  • Integrated support for unit testing
     
  • Jinja2 template engine for rendering HTML templates
     
  • RESTful request dispatching
     
  • Modular design with extensions for added functionality
     
  • Integrated support for cookies & sessions
     
  • Pluggable views, templates, & controllers

Example of a simple Flask application

from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
    return 'Hello, World!'
if __name__ == '__main__':
    app.run()


In this example, we create a Flask application instance & define a route for the root URL ('/') using the `@app.route` decorator. The `hello` function is the view associated with this route, & it returns a simple "Hello, World!" response.

3. Pyramid

Pyramid is a flexible & extensible Python web framework that emphasizes modularity & simplicity. It follows the principle of "pay only for what you use," meaning that developers can choose the components they need & avoid unnecessary complexity. Pyramid is well-suited for projects of any size, from small single-file applications to large-scale enterprise systems.

Features of Pyramid

  • Flexible & modular architecture
     
  • Support for various databases & ORMs (SQLAlchemy, ZODB, etc.)
     
  • URL dispatch & traversal-based routing
     
  • Templating using Chameleon, Jinja2, or Mako
     
  • Built-in security & authentication system
     
  • Extensible through add-ons & plugins
     
  • Testing & documentation tools
     
  • Support for both imperative & declarative programming styles

Example of a simple Pyramid view

from pyramid.view import view_config
from pyramid.response import Response
@view_config(route_name='hello')
def hello_world(request):
    return Response('Hello, World!')


In this example, we define a view function `hello_world` using the `@view_config` decorator. The `route_name` parameter specifies the name of the route associated with this view. The view function takes a `request` object as a parameter & returns a `Response` object with the "Hello, World!" message.

4. CherryPy

CherryPy is an object-oriented web framework that offers a minimalistic approach to web development. It includes a built-in HTTP server and provides tools for handling routing, sessions, and cookies. CherryPy's design emphasizes flexibility and ease of integration, allowing developers to embed it within existing applications or use it as a standalone server.

Features of CherryPy

  • Object-oriented web framework
     
  • Built-in HTTP server
     
  • Minimalistic design with flexible configuration
     
  • Integrated support for sessions, cookies, and error handling
     
  • Easy to extend and embed in existing applications

Example of a Simple CherryPy Application

import cherrypy
class HelloWorld:
   @cherrypy.expose
   def index(self):
       return "Hello, World!"
if __name__ == '__main__':
   cherrypy.quickstart(HelloWorld())


In this example, we define a simple CherryPy application that serves a "Hello, World!" message. The HelloWorld class contains a method index that is exposed as a web route using the @cherrypy.expose decorator. When you run the application and visit the root URL, it will display the message "Hello, World!". CherryPy's built-in server automatically handles the request and routing.

5. Bottle

Bottle is a micro-framework that is lightweight and designed to be simple to use. It provides the essential components for web development within a single file, making it easy to deploy and manage. Bottle's straightforward approach and built-in HTTP server make it ideal for small projects and prototyping.

Features of Bottle

  • Lightweight & single-file framework
     
  • Built-in HTTP server
     
  • Integrated support for routing & templating
     
  • Easy to deploy & simple to use
     

Example of a Simple Bottle Application

from bottle import Bottle, run
app = Bottle()
@app.route('/')
def hello():
   return "Hello, World!"
if __name__ == '__main__':
   run(app, host='localhost', port=8080)


In this example, we create a simple Bottle application that returns "Hello, World!" when the root URL (/) is accessed. The @app.route decorator maps the root URL to the hello function. The run function starts the Bottle web server on localhost at port 8080.

6. CubicWeb

CubicWeb is a semantic web framework that focuses on the organization and management of structured data. It utilizes an object-oriented data model and integrates RDF (Resource Description Framework) to handle complex data relationships. CubicWeb is designed for applications that require rich data interaction and management features.

Features of CubicWeb

  • Semantic web framework
     
  • Object-oriented data model
     
  • Web-based data access & management
     
  • Built-in support for RDF (Resource Description Framework)
     
  • Extensible with reusable components
     
  • Integrated application components (e.g., user management, notifications)

Example of a Simple CubicWeb Application 

from cubicweb import Application, Repository
from cubicweb.web import App
from cubicweb.server import start
from cubicweb.dbapi import connect
class HelloWorldApp(App):
   def call(self, environ, start_response):
       start_response('200 OK', [('Content-Type', 'text/plain')])
       return [b"Hello, World!"]
if __name__ == '__main__':
   app = HelloWorldApp()
   start(app)


In this example, a simple CubicWeb application is set up, which returns "Hello, World!" when accessed. CubicWeb provides an architecture for building semantic web applications, and here we define an application class HelloWorldApp that handles HTTP requests. The start function initiates the application server.

7. FastAPI

FastAPI is a modern, high-performance web framework for building APIs with Python. It leverages type hints for automatic API documentation and validation, and its asynchronous capabilities ensure fast and efficient handling of requests. FastAPI is particularly well-suited for projects that require high performance and scalability.

Features of FastAPI

  • High performance & asynchronous support
     
  • Type hints & automatic API documentation
     
  • Dependency injection system
     
  • Fast & efficient request handling
     
  • Built-in support for OAuth2 & JWT authentication
     
  • Pydantic for data validation

Example of a Simple FastAPI Application

from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
   return {"message": "Hello, World!"}
if __name__ == "__main__":
   import uvicorn
   uvicorn.run(app, host="127.0.0.1", port=8000)

In this example, we create a FastAPI application with a simple endpoint that returns a JSON object containing "Hello, World!" when accessed at the root URL (/). FastAPI is an asynchronous framework known for its performance, and uvicorn is used to run the application server.

8. Tornado

Tornado is a web framework and asynchronous networking library designed for handling large volumes of traffic with high performance. It features non-blocking I/O and is well-suited for applications requiring long-lived network connections, such as real-time web services and chat applications.

Features of Tornado

  • Asynchronous networking library
     
  • High-performance non-blocking I/O
     
  • Support for long-lived network connections
     
  • Built-in HTTP server
     
  • Scalable for handling large amounts of traffic

Example of a Simple Tornado Application

import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
   def get(self):
       self.write("Hello, World!")
def make_app():
   return tornado.web.Application([
       (r"/", MainHandler),
   ])
if __name__ == "__main__":
   app = make_app()
   app.listen(8888)
   tornado.ioloop.IOLoop.current().start()


In this example, we create a simple Tornado application that returns "Hello, World!" when the root URL (/) is accessed. The MainHandler class defines how requests to this route are handled, and tornado.ioloop.IOLoop is used to run the application server on port 8888.

9. Falcon

Falcon is a lightweight web framework aimed at building high-performance APIs. Unlike other frameworks, Falcon is focused on providing minimal overhead and gives developers close control over HTTP and REST APIs. It's highly optimized for performance and allows handling a large number of simultaneous requests with low latency.

Features of Falcon

  • Designed to be one of the fastest frameworks for building APIs.
     
  • Falcon provides only the essentials, making it lightweight and efficient.
     
  • It can handle asynchronous tasks via ASGI.
     
  • Developers have control over request and response handling, middleware, and routing.
     
  • Works well with both WSGI and ASGI.

Example of a Simple Falcon Application:

import falcon
class HelloWorldResource:
   def on_get(self, req, resp):
       resp.status = falcon.HTTP_200
       resp.media = {"message": "Hello, World!"}
app = falcon.App()
app.add_route('/hello', HelloWorldResource())

10. Web2py

Web2py is a full-stack framework designed for ease of use, with a focus on productivity and simplicity. It includes a web-based IDE, supports rapid development of scalable web applications, and promotes agile practices. Web2py also provides automatic security measures like form validation and SQL injection prevention.

Features of Web2py

  • Comes with a built-in web IDE, making development possible through a browser.
     
  • Automatically handles common security issues such as XSS, SQL Injection, and CSRF.
     
  • Provides everything needed for development, including an ORM, template engine, and validation.
     
  • Works on Windows, Linux, Mac, and even Android devices.

Example of a Simple Web2py Application:

def index():
   return dict(message="Hello from Web2py!")

Frequently Asked Questions

What is the difference between Django & Flask?

Django is a full-stack web framework that provides a complete set of features for building web applications, while Flask is a lightweight micro-framework that focuses on simplicity & flexibility. Django is better suited for large & complex projects, while Flask is ideal for small to medium-sized applications or microservices.

Can Python frameworks be used for building APIs?

Yes, Python frameworks like Django & Flask have excellent support for building RESTful APIs. Django REST Framework is a powerful toolkit for creating APIs on top of Django, while Flask can be extended with libraries like Flask-RESTful or Flask-API to build APIs easily.

Are Python frameworks suitable for real-time applications?

While Python frameworks are primarily designed for building web applications, they can be used in combination with libraries like Django Channels or Flask-SocketIO to enable real-time functionality. These libraries provide support for WebSocket communication, allowing for real-time updates & bidirectional communication between the server & the client.

Conclusion 

In this article, we have discussed some of the most popular Python frameworks for web development. We learned about Django, a full-stack framework that provides a rich set of features, Flask, a lightweight & flexible micro-framework, & Pyramid, a modular & extensible framework. Whether you're building a complex enterprise application or a simple web service, Python frameworks offer a solid foundation for efficient & effective web development.

Recommended Readings:

Live masterclass