Building db frontends in Python

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

How to build a simple webbased database frontend in Python? It basically has to do CRUD (create, read, update & delete records) for a MariaDB database?

Different approaches

Let's have a comprehensive overview of the major options:

  • Use a Python framework
  • Use a CMS - E.g., Django CMS or Wagtail
  • Raw Python - Probably as hard as developing a raw WordPress theme
  • Using a low-code/no-code platform like Airtable or Google AppSheet - Very quick, but not what I'm looking for.

Conclusion (for now): Use a framework.

Frameworks

Long list

Python frameworks under consideration for developing a simple database frontend - Long list
Framework Description Features Use Cases Website
Django A high-level web framework that encourages rapid development and clean, pragmatic design.
  • Built-in admin interface
  • ORM (Object-Relational Mapping)
  • Authentication system
  • Scalability and security
  • Large-scale web applications
  • E-commerce sites
  • Content management systems
Django
Flask A micro-framework for Python based on Werkzeug and Jinja2.
  • Lightweight and modular
  • Flexible with extensions available for ORM, authentication, etc.
  • Simple to set up and use
  • Small to medium-sized web applications
  • APIs.
Flask
FastAPI A modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
  • High performance
  • Automatic interactive API documentation
  • Asynchronous capabilities
  • Easy to use with modern Python features
  • High-performance APIs
  • Asynchronous web applications
FastAPI
Pyramid A lightweight, flexible web application development framework.
  • Flexibility and modularity
  • Suitable for both small and large applications
  • Good documentation and community support
  • Versatile applications
  • Scalable web services
Pyramid
Tornado A scalable, non-blocking web server and web application framework.
  • Asynchronous networking library
  • High performance
  • Built-in support for real-time web features
  • Real-time applications
  • Web sockets
  • Applications requiring long-lived network connections.
Tornado
Bottle A fast, simple, and lightweight WSGI micro web-framework for Python.
  • Single file application
  • No dependencies other than the Python Standard Library
  • Simple to set up and use
  • Small web applications
  • Prototyping
Bottle
CherryPy An object-oriented web framework that allows developers to build web applications in much the same way they would build any other object-oriented Python program.
  • Built-in tools for sessions, cookies, encoding, etc.
  • A multi-threaded web server
  • Plugin system for extensibility
  • Web services
  • Web applications
CherryPy
Sanic A web server and web framework that is designed to be fast and asynchronous.
  • Asynchronous capabilities
  • High performance
  • Easy to use with modern Python features
  • High-performance web applications
  • APIs
Sanic
Web2py A full-stack framework that focuses on ease of use and rapid development.
  • Built-in web-based IDE
  • MVC architecture
  • Security features
  • Rapid development of web applications
  • Educational purposes
Web2py
Hug An API development framework that makes it easy to create APIs.
  • Built-in versioning
  • Support for multiple interfaces (CLI, HTTP, etc.)
  • Asynchronous capabilities
  • API development
  • Microservices
Hug

Short list

Criteria Flask Django
Simplicity and Minimalism
  • Lightweight micro-framework
  • Minimal boilerplate
  • Full-featured framework with many built-in tools
Flexibility
  • Unopinionated and customizable
  • Easy integration with various extensions (including ORM)
  • More opinionated with a set structure
  • Comes with built-in components (ORM, templating engine)
Learning Curve
  • Easier for beginners
  • Focus on core web development concepts
  • Steeper learning curve due to more features and configurations
Performance
  • Less overhead, potentially better performance for smaller applications
  • May have more overhead due to built-in features
API Development
  • Well-suited for microservices and APIs
  • Quick development of RESTful APIs
  • Suitable for building APIs, but more features may be unnecessary for simple APIs
Use Cases
  • Ideal for quick prototyping
  • Suitable for small applications with a single responsibility
  • Better for large, complex applications
  • Suitable for data-driven applications
Feature-Rich
  • Minimal built-in features, relies on extensions
  • Comprehensive framework with many built-in features
  • Includes admin interface, ORM, authentication, form handling
Security
  • Requires additional work to implement security features
  • Built-in security features against common web vulnerabilities
Scalability and Maintainability
  • Flexible project structure, may require more effort to maintain
  • Enforced structure and conventions for maintainable and scalable code
Rapid Development
  • Minimal setup, good for quick prototyping
  • Built-in tools for rapid development, especially for data-driven applications

Conclusion: I choose Flask: This will be the first time I do such a thing, so use the easier framework.