Latest news about Bitcoin and all cryptocurrencies. Your daily crypto news habit.
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
Official Website | GitHub | PyPI |Â Awesome
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 authentication, URL routing,template engine, object-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 PostgreSQL, MySQL, SQLite, 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
Official Website | GitHub | PyPI |Â Awesome
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:
- Single-file applications
- URL generation
- Extensible configuration
- All-embracing templating and asset specifications
- Flexible authentication and authorization
- Testing, support, and comprehensive data documentation
- View predicates and many per-route views
- Function decorators
- Predicates
- Renderers
TurboGears
Official Website | GitHub |Â PyPI
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:
- Multi-database support
- MVC-style architecture
- Support for SQLObject and SQLAlchemy
- Kid and Genshi included in preferred templating languages
- Validation with FormEncode
- Pylons as a web server
- ToscaWidgets, an application library that simplifies coordination of frontend design and server development
- PasteScript templates
- Front-facing WSGI-based servers (Paste HTTP server, CherryPy WSGI/HTTP server, etc.)
- Command-line tools
- MochiKit JavaScript library integration
- All features implemented as function decorators
Web2py
Official Website | GitHub |Â PyPI
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 Engine, Amazon 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
Official Website | GitHub | PyPI |Â Awesome
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 toolkit and 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:
- Built-in development server and a fast debugger
- Integrated support for unit testing
- RESTful request dispatching
- Jinja2 templating
- Secure cookies support (client-side sessions)
- WSGI 1.0 compliance
- Unicode-based
- Ability to plug in any ORM
- HTTP request handling
Bottle
Official Website | GitHub |Â PyPI
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 mako, jinja2, 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 fapws3, bjoern, GAE, ĐĄ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
Official Website | GitHub |Â PyPI
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:
- An HTTP/1.1-compliant WSGI thread-pooled webserver
- Simplicity of running multiple HTTP servers at once
- A powerful configuration system
- A flexible plugin system
- Out-of-the-box tools for caching, encoding, sessions, authentication, static content, and so on
- Built-in support for profiling, coverage, and testing
- Ability to run on Python 2.7+, Python 3.1+, PyPy, Jython, and Android
Asynchronous frameworks
Sanic
Official Website | GitHub |Â PyPI
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
Official Website | GitHub |Â PyPI
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:
- Built-in support for user authentication
- Real-time services
- High-quality performance
- Python-based web templating language
- Non-blocking HTTPÂ client
- Implementation of third-party authentication and authorization schemes (Google OpenID/OAuth, Facebook Login, Yahoo BBAuth, FriendFeed OpenID/OAuth, Twitter OAuth)
- Support for translation and localization
Other
Dash
Official Website | GitHub | PyPI |Â Awesome
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.
Choosing a Python web framework
The right framework might be all you need to develop a successful project. We really hope that youâve found an interesting framework in this article. We also have another one, the 17 best Python web frameworks of 2017, if youâre interested in exploring more options.
Weâd love if you visited our corporate GitHub page. Our SteelKiwi developers are trying hard to innovate in the world of tech, and the more people who get involved, the better.
Top 10 Python Web Frameworks to Learn in 2018 was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.
Disclaimer
The views and opinions expressed in this article are solely those of the authors and do not reflect the views of Bitcoin Insider. Every investment and trading move involves risk - this is especially true for cryptocurrencies given their volatility. We strongly advise our readers to conduct their own research when making a decision.