Best practices to protect your Flask applications
How to secure your Flask applications
Want to know how to protect your Flask applications? Dive into our latest blog post, where we guide you through the best practices for Flask security. Explore how these techniques can not only enhance the security of your web applications but also bring tangible benefits to your development journey.
In this guide, Escape’s security research team has gathered the most crucial tips to protect your Flask applications from potential breaches, including how to implement CSRF protection for Flask. Our goal is to empower you to create more resilient and efficient Flask projects. Let’s get started!
https://escape.tech/blog/best-practices-protect-flask-applications/
Handling File Uploads With Flask
A common feature in web applications is to let users upload files to the server. The HTTP protocol documents the mechanism for a client to upload a file in RFC 1867, and our favorite web framework Flask fully supports it, but there are many implementation details that fall outside of the formal specification that are unclear for many developers. Things such as where to store uploaded files, how to use them afterwards, or how to protect the server against malicious file uploads generate a lot of confusion and uncertainty.
In this article I’m going to show you how to implement a robust file upload feature for your Flask server that is compatible with the standard file upload support in your web browser as well as the cool JavaScript-based upload widgets
https://blog.miguelgrinberg.com/post/handling-file-uploads-with-flask
How To: Create a Flask API with JWT-Based Authentication
This tutorial series provides step-by-step instructions and in-depth explanations to guide you through the process of creating a robust, production-quality REST API. The toolstack consists of Flask, Flask-RESTx, SQLAlchemy, pyjwt, tox and other packages. Code quality is a major focus, with considerable time dedicated to testing (using pytest), logging and tools such as coverage, flake8 and mypy. The tutorial concludes by creating a process that continuously integrates (with tox, travis/circle CI, coveralls) and deploys the API (with either Github or Azure DevOps to Heroku).
Source:
https://aaronluna.dev/series/flask-api-tutorial/overview/
Form Handling in Flask
Forms are an essential part of any web application but unfortunately working with them is quite difficult. It all starts with the client, first, you have to validate the data on client side, then on the server. If that’s not enough, you have take care of all the security concerns like CSRF, XSS, SQL Injection and so on. All in all, that’s a lot of work. Fortunately, we have an excellent library called WTForms to do the heavy lifting for us. Before we learn more about WTForms, the following section gives you a little tour on how you can go about handling forms in Flask without using any library or package.
Providing feedback and notifications to users using Flask’s flash function
Providing feedback to users of a web application is critical, from notifications and error messages to warnings and progress alerts.
If the application doesn’t the right level of feedback, chances are the user will become frustrated and end up having a bad experience.
Fortunately for us, Flask provides a simple way to send messages from the server to the client using flash.
https://pythonise.com/series/learning-flask/flask-message-flashing
Running Flask on Kubernetes
Posted by Michael Herman on Sep 19, 2018
In this post, we’ll first take a look at Kubernetes and container orchestration in general and then we’ll walk through a step-by-step tutorial that details how to deploy a Flask-based microservice (along with Postgres and Vue.js) to a Kubernetes cluster.
https://testdriven.io/running-flask-on-kubernetes
Source:
https://pycoders.com
DigitalOcean – How To Structure Large Flask Applications
Introduction
There are many methods and conventions for structuring Python web applications. Although certain frameworks are shipped with tools (for scaffolding) to automate — and ease — the task (and the headaches), almost all solutions rely on packaging / modularizing applications as the codebase gets distributed [logically] across related files and folders.
The minimalist web application development framework Flask, has its own – blueprints.
Read the full article in the link below:
https://www.digitalocean.com/community/tutorials/how-to-structure-large-flask-applications