Practical solutions

Solve the problem. Keep building.

Collection of Python Flask how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries

How to Set Port in FlaskLearn how to set the port in Flask with this comprehensive guide. Explore various methods including hardcoding, using environment variables, and Flask-Script for enhanced control. Perfect for both beginners and experienced developers looking to streamline their Flask applications.Flask g ObjectIn this comprehensive guide, explore the Flask g object and learn how to effectively manage request-specific data in your web applications. Discover practical examples, best practices, and tips for utilizing this powerful feature to enhance your Flask development experience. Perfect for both beginners and seasoned developers looking to optimize their applications.How to Run a Flask AppWe will learn with this explanation about how we can set up a Flask environment in Visual Studio Code and create a basic application of Flask.How to Create Route in Flask AppWe will learn with this explanation about how we can create route in Flask and how we get a response when we call the route in Flask.How to Redirect in Python FlaskWe will learn, with this explanation, how to use the redirect() function to redirect the user and see how we can use it for multiple purposes in Flask.How to Post Request in Python FlaskWe will learn with this explanation about two basic HTTP methods (get and post) and we will also learn the differences between both of them and then go through a basic example of how we can send data from a basic form in the Flask.How to Create a Static Folder in FlaskWe will learn, with this explanation, how to use static assets or static files inside the static directory, and we will also learn how to import our custom CSS file in Flask.How to Return a Valid JSON Response in FlaskWe go to learn with this explanation about JSON support in the flask and we also go to learn how to create an api and how to return it in JSON response with the help of jsonify() in the flask.How to Use Different Types of Parameters Inside the URL in FlaskWe will learn, with this explanation, about URL converters in the Flask app which means the ability to pass parameters in any URL. We will also learn how to pass different types of parameters inside the URL in the Flask app.How to Handle Request Data in JSON Format in FlaskWe will learn, with this explanation, what JSON is and how to handle incoming request data in JSON format. We will also learn how to use the Postman Chrome extension to send JSON data.How to Use Flask Debug ModeWe will learn, with this explanation, about a couple of things we get when we use the debug mode in Flask, and we will also learn how to use an extension that provides a debugger toolbar.How to Display an Image in Flask AppWe will learn, with this explanation, how we can add an image to a web page and upload or display multiple images in the Flask app.How to Create Dynamic URL Using url_for in FlaskWe will learn, with this explanation, what the url_for() function does and how we can create a dynamic URL in Flask. We will also learn how we can use url_for() inside the template.How to Change the Default Port in FlaskWe will learn how to change the port when we run our Flask app using different methods.How to Get Query Parameters Using FlaskWe will learn, with this explanation, how to get the parameters from the URL with the help of the request query string in Flask.How to Download a File Using FlaskWe will learn, with this explanation, how to make a downloadable link to download a file as an attachment with the help of the send_file function in Flask.How to Connect MySQL Database in FlaskWe will learn, with this explanation, how to connect a MySQL database in Flask with the help of flask_mysqldb. We will also learn how to set up a database online.How to Log Errors Using FlaskWe will learn, with this explanation, about error handling, specifically logging errors. By the end of this article, you should know how to log errors to a file and where to go to check out other ways to log errors in Flask.How to Use a Production WSGI Server to Run a Flask AppWe will learn, with this explanation, about the WSGI server and see how it works. We will also learn how to create a WSGI server and run an app inside this server in Flask and Python.How to Update Flask SQLAlchemy We will learn, with this explanation, how to insert and update a row with the help of the SQLAlchemy database in the Flask app.How to Submit Ajax in Python FlaskWe will learn, with this explanation, how to submit an AJAX form with the help of jQuery and Flask, where jQuery handles the AJAX part and Flask accepts the AJAX request.How to Run Host 0.0.0.0 in Python FlaskIn this guide, we will look how to run flask host 0.0.0.0.How to Use the Flask redirect() Function With ParametersIn this article, we will discuss Flask's redirect() function. What is its parameter, how is it used, and what is needed to execute it?How to Delete a Record in Flask SQLAlchemyIn this guide, we will see what SQLAlchemy is, how to download SQLAlchemy on our systems and how to implement it. Also, we will demonstrate how the delete function is used in SQLAlchemy.Flask Project StructureWe will learn, with this explanation, how to structure a big Flask application with the help of the Blueprint Approach in Flask and Python.Flask jsonifyThis guide will see what is jsonify and dumps it in the flask.Flask WebSocketsWe will learn, with this explanation, what WebSocket is and how it works between client and server. We will also learn how to make a real-time chat application with the help of the flask_socketio module in Flask.Flask send_file()We will learn, with this explanation, how to upload files to the SQLAlchemy database and then download those files from the database in Flask.Flask request.args.getWe will learn, with this explanation, how to work with the request.args.get. We will also learn the possible way to get an error when we use the request object and its attribute in Flask.Flask Secret KeyThis explanation is about what is a secret key, why we need to use it within the session, how we can generate the secret key using different ways, and how it is useful when we work with debug toolbar in Flask.Flask CORSThis explanation is about an issue that comes when we create API in the Flask app and how to fix an error when we try to access a Flask app from a different domain.Flask Request FormWe will learn, with this explanation, about two things that happen when we submit a form and how we can receive and get the form data with the help of Flask and Python.