How To Create Flask Base Template

How To Create Flask Base Template

In Flask just like in most web development frameworks, you can make use of base templates and the extending of templates to reduce repetitive markup. In other words, you can have a base HTML file and have components from that shown on every single webpage. We can refactor some of the markups we have created already in our Flask application in order to make use of templates that extend from other templates and use various blocks to get the layout we want.…

How To Use Flash Messages In Python Flask

How To Use Flash Messages In Python Flask

Flash messages are used in web applications to provide helpful feedback to users as they navigate a graphical user interface. You are likely familiar with flash messages if you have ever signed up for an account with any of the popular services available on the Internet today. These messages typically appear one time for a given event and disappear after a short period of time with the help of some simple JavaScript code.…

How To Redirect To Url In Python Flask

How To Redirect To Url In Python Flask

The redirect() function allows us to redirect a user to the URL of our choice. In the Flask application that we are building so far, we have a /shortenurl route that checks to see what method type is in use. If it is a GET request, we are simply returning some text to the user. Instead of that, we can redirect them to the homepage so they can enter a URL and shortcode.…

How To Use Forms In Python Flask

How To Use Forms In Python Flask

Allowing a user to submit data to your web application is a universal need. No matter what web framework or solution you are using, HTML Forms are the method typically used to gather and submit data from an end-user to a web application. In this tutorial, we’ll take a look at how to get forms to work in Flask, how to get form data in Flask, and how to access various form fields when using Flask.…

How To Use Flask Page Templates

How To Use Flask Page Templates

The last tutorial taught us how to set up some routes in Flask and in this tutorial we’ll see how page templates work in Flask. The original routes we created returned simple strings to the web browser when visiting a given route. Strings are not enough to create a website, we need things like HTML, CSS, and maybe some JavaScript to create more robust pages for our users.…

How To Create Routes In Flask

How To Create Routes In Flask

Flask is a Python framework for web development where you can get up and running with a single file and five lines of code! Flask is also a great way to create an API and you can create a JSON API in one line of code. Flask has many powerful features to help you develop websites quickly. There is a templating system, message flashing, URL routing, support for serving static files, and more.…

How To Use MySQL and MariaDB In Python

How To Use MySQL and MariaDB In Python

MySQL and MariaDB are relational database engines that are very popular systems used with Python. They use a relational model with tables to describe relationships between data. MySQL and MariaDB follow a client-server relationship. In other words, the database exists on a server. To make changes to the database, you send a request to the server. The request contains various SQL statements or instructions selecting, updating, or deleting data.…