Skip to main content

Top 10 Python Web Frameworks to Learn in 2018

Frameworks make developers’ lives easier by offering them a structure for application development. They automate the implementation of common solutions, cutting development time and allowing developers to focus more on application logic instead of routine elements.
In this article, we share our own list of the top ten Python web frameworks that we believe will be useful on your way to becoming a professional backend developer and improving your existing skill set. Keep in mind that these frameworks are listed in no particular order: we’ve focused on showing what you’re able to do as opposed to telling what you should do.

Some things to consider

When deciding which framework to use, look at the size and complexity of your project. If what you’re looking to develop is a large system packed with features and requirements, a full-stack framework might be the right choice. If your app is on the smaller and simpler side, you should probably consider a microframework.
You can find information about the type and focus of some frameworks here. A final decision, though, should come from your own understanding of your project and the tasks you want to simplify.
However, frameworks can also stand in the way of development. When choosing a full-stack framework, you’re often signing up for a set of limitations. Of course, you can find ways to work around them, but be careful you don’t spend more time fighting for your own freedom than you would have writing an app in pure Python.

Full-stack frameworks

Django

GitHub Stars: 31,592 | GitHub Forks: 13,361
Django is a free open-source full-stack Python framework. It tries to include all of the necessary features by default as opposed to offering them as separate libraries.
Some of the exemplary features of Django are its authenticationURL routing,template engineobject-relational mapper (ORM), and database schema migrations (Django v.1.7+).
Django uses its ORM to map objects to database tables. The same code works with different databases and isn’t difficult to transfer from one database to another. The main databases that Django works with are PostgreSQLMySQLSQLite, and Oracle, but third-party drivers allow you to use others as well.
Here at SteelKiwi, we use Django as our primary framework for backend development. If you’d like to see the amazing apps we’ve already developed with Django, visit our Projects page.

Pyramid

GitHub Stars: 2,640 | GitHub Forks: 782
Pyramid is an open-source Python-based web application framework. Its main goal is to do as much as possible with minimum complexity.
The most striking feature of Pyramid is its ability to work well with both small and large applications. Some of Pyramid’s great features include:

TurboGears

GitHub Stars: 230 | GitHub Forks: 56
TurboGears is an open-source, data-driven full-stack web application framework.
It allows you to quickly develop extensible data-driven web applications. TurboGears comes with user-friendly templating and a powerful and flexible ORM.
Some of TurboGears’ distinctive features include:

Web2py

GitHub Stars: 1,536 | GitHub Forks: 742
Web2py is a scalable open-source full-stack Python framework. However, you should know before reading further that Web2py does not support Python 3.
What’s great about Web2py, though, is that it comes with its own web-based IDEwhich, among other things, includes a code editor, debugger, and one-click deployment.
Other valuable Web2py features include:
  • No requirements for installation and configuration
  • Ability to run on Windows, Mac, Linux/Unix, Google App EngineAmazon EC2, and any web hosting that supports either Python 2.5–2.7 or Java+Python
  • Readability of multiple protocols
  • Data security that prevents such vulnerabilities as cross-site scripting, injection flaws, and malicious file execution
  • Successful employment of software engineering practices, making code easy to read and maintain
  • Error tracking, thorough error logging and ticketing
  • Role-based access control
  • Support for internationalization
  • Backward compatibility that ensures user-oriented advancement without the need to lose ties with earlier versions

Microframeworks

Flask

Github Stars: 32,959 | GitHub Forks: 10,254
Flask is a Python framework available under the BSD license. It was inspired by the Sinatra Ruby framework. Flask depends on the Werkzeug WSGI toolkitand Jinja2template.
The main idea behind Flask is to help build a solid web application foundation. From there, you can use any extensions you might need.
Flask’s lightweight and modular design makes it easily adaptable to developers’ needs. It includes a number of useful out-of-the-box features:

Bottle

GitHub Stars: 5,198 | GitHub Forks: 1,065
Bottle is a microframework. Originally meant for building APIs, Bottle implements everything in a single source file. It has no dependencies apart from the Python Standard Library. Coding with Bottle gets you closer to the metal than coding with any full-stack framework.
Its default features include routing, templating, utilities, and a basic abstraction over the WSGI standard.
  • Routing — supports requests to function-call mapping, allowing you to achieve clean and dynamic URLs
  • Templates — a fast and Pythonic template engine out of the box along with full support for makojinja2, and cheetah
  • Utilities — comfortable access to form data, file uploads, cookies, headers, and other HTTP-related metadata
  • Server — a built-in HTTP development server that supports fapws3bjoernGAEСherryPy, and any other WSGI-capable HTTP server
Bottle is a perfect solution for prototyping, learning the organization of web frameworks, and building simple personal apps.

CherryPy

GitHub Stars: 595 | GitHub Forks: 161
CherryPy is an open-source, minimalist web framework. It makes building Python web applications no different than building any other object-oriented program.
In fact, a CherryPy-powered web app is a standalone Python application that embeds its own multi-threaded web server. CherryPy apps run on any operating system that supports Python (Windows, macOS, Linux, etc.). They can be deployed anywhere you can run an ordinary Python app. You don’t need Apache for CherryPy apps, but you can run a CherryPy app behind Apache just as well as you can run it behind Lighttpd or IIS.
CherryPy isn’t a very limiting framework, as it allows you to use any type of technology for templating, data access, and so on. However, it’s still able to handlesessions, statics, cookies, file uploads, and everything else that a web framework typically can.

Some of the default CherryPy features include:

Asynchronous frameworks

Sanic

GitHub Stars: 8,488 | GitHub Forks: 776
Sanic is a Python web framework built on uvloop and created specifically for fast HTTP responses via asynchronous request handling.
It runs on Python 3.5+. Sanic supports asynchronous request handlers, which makes it compatible with Python 3.5’s async/await functions. This enhances its speed, offering non-blocking capabilities.
In a benchmark test with one process and 100 connections, Sanic was able to handle 33,342 requests per second.

Tornado

GitHub Stars: 15,126 | GitHub Forks: 4,432
Tornado is a Python web framework and asynchronous networking library. It uses a non-blocking network I/O and solves the C10k issue (meaning that, if configured properly, it can handle 10,000+ concurrent connections).
This makes it a great tool for building applications requiring high performance and tens of thousands of concurrent users.
Tornado’s main features are:

Other

Dash

GitHub Stars: 3,903 | GitHub Forks: 360
Dash is an open-source Python framework used for building analytical web applications. It’s especially good for Python data scientists who aren’t very familiar with web development.
Dash applications are web servers that run Flask and communicate with JSON packets over HTTP requests. Their frontend renders components with React.js.
Apps developed with Dash are rendered in the web browser and can be deployed to servers. This also means that Dash applications are inherently cross-platform and mobile-ready.
Dash developers have access to the underlying Flask instance and all of its configurable properties. To extend the capabilities of Dash applications, developers can also use the rich set of Flask Plugins.

Popular posts from this blog

How to read or extract text data from passport using python utility.

Hi ,  Lets get start with some utility which can be really helpful in extracting the text data from passport documents which can be images, pdf.  So instead of jumping to code directly lets understand the MRZ, & how it works basically. MRZ Parser :                 A machine-readable passport (MRP) is a machine-readable travel document (MRTD) with the data on the identity page encoded in optical character recognition format Most travel passports worldwide are MRPs.  It can have 2 lines or 3 lines of machine-readable data. This method allows to process MRZ written in accordance with ICAO Document 9303 (endorsed by the International Organization for Standardization and the International Electrotechnical Commission as ISO/IEC 7501-1)). Some applications will need to be able to scan such data of someway, so one of the easiest methods is to recognize it from an image file. I 'll show you how to retrieve the MRZ infor...

How to generate class diagrams pictures in a Django/Open-edX project from console

A class diagram in the Unified Modeling Language ( UML ) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects. https://github.com/django-extensions/django-extensions Step 1:   Install django extensions Command:  pip install django-extensions Step 2:  Add to installed apps INSTALLED_APPS = ( ... 'django_extensions' , ... ) Step 3:  Install diagrams generators You have to choose between two diagram generators: Graphviz or Dotplus before using the command or you will get: python manage.py graph_models -a -o myapp_models.png Note:  I prefer to use   pydotplus   as it easier to install than Graphviz and its dependencies so we use   pip install pydotplus . Command:  pip install pydotplus Step 4:  Generate diagrams Now we have everything installed...

How to Remove course from Open-edX

Go to vagrant  => 1. In the edx-platform directory:  - cd /edx/app/edxapp/edx-platform 2. Run the following Django management command:   - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings aws    - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms dump_course_ids --settings=devstack 3. Find the course ID which you'd like to delete in the resulting list of course IDs. 4. Copy the course ID into the following command and run it:  - sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings aws  -   sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms delete_course <COURSE_ID> --settings=devstack  - You'll be asked to verify the deletion . To verify the deletion, run the command from step 2 above and ensure that the course ID is not in the list. Help reference : ...