What is Framework in Python
A framework is a collection of modules or packages which help in writing web applications. While using frameworks in python the programmer doesn’t have to worry about the low-level details such as protocols, sockets, or thread management.
Frameworks automate the common implementation of common solutions which gives the flexibility to the users to focus on the application logic instead of the basic routine processes.
They provide common patterns in a web application that are fast, reliable, and easily maintainable.
Operations involved in a web application using a web framework:
- Url Routing – Routing is the mechanism of mapping the URL directly to the code that creates the web page.
- Input form handling and validation – Suppose you have a form which takes some input, the idea is to validate the data and then save it.
- Output formats with template engine – A template engine allows the developers to generate desired content types like HTML, XML, JSON.
- Database connection – Database connection configuration and persistent data manipulation through an ORM.
- Web security – Frameworks give web security against cross-site request forgery aka CSRF, sql injection, cross-site scripting and other common malicious attacks.
- Session storage and retrieval – Data stored in the session storage gets cleared when the page session ends.
Advantages Of Frameworks
- Open-source
- Good documentation
- Efficient
- Secure
- Integration
Frameworks make it easier to reuse the code for common HTTP operations. They structure the projects in a way so that the other developers with the knowledge of the framework can easily maintain and build the application.
Top 5 Frameworks In Python
- Django
- Web2Py
- Flask
- Bottle
- CherryPy