Docker Compose – Dockerizing Flask MySQL App

Introduction It is considered to be a best practice for a container to have only one process with single responsibility. But as I am going to dockerize Python based Flask web app and MySQL server for storing data for the app, so I need two containers – one for running the app and another one for running the MySQL database server. So these two containers are running independently and to establish communication between these two containers you need docker compose. I am also going to show you how to install…

Continue

How to Create, Build, Package and Run Python Flask Application with Docker

Introduction In this tutorial I am going to show you how to create a simple Python Flask REST API in Linux based CentOS 7 system. Then I am going to show you how to build, package and run this Python Flask application with Docker. Here I am creating an endpoint that returns Hello, World! in JSON format. In my other tutorial I had discussed how to install docker on CentOS 7. I am not going to tell you here why do you need docker but you can read it from my previous…

Continue

Autocomplete input suggestion using Python and Flask

Introduction Autocomplete is a feature in which an application predicts the rest of a word a user is typing. In graphical user interfaces, users can typically press the tab key to accept a suggestion or the down arrow key to accept one of several. Autocomplete speeds up human-computer interactions when it correctly predicts the word a user intends to enter after only a few characters have been typed into a text input field. The autocomplete is a normal text input enhanced by a panel of suggested options.

Continue

Upload and display multiple images using Python and Flask

Introduction Here I am going to show you how to upload multiple images and display them one by one once images get uploaded. I am using here Flask as a web based framework on top of Python language. On the UI (User Interface) we have input field which is used to select multiple files. To select multiple files after clicking on browse button you need to hold Ctrl key (Windows OS) on the keyboard.

Continue

Delete Multiple Rows from Table using Flask, AJAX, jQuery, MySQL

In this tutorial we build an application using Python based Flask framework to fetch all products from MySQL database and display on the HTML table. This example is all about to delete multiple rows from HTML as well as database tables. We will use IN clause with WHERE condition in MySQL query to delete multiple rows from database table. We will put checkbox against each row on the table so that user will be able to select a particular row for deletion. We will also put a checkbox on the…

Continue

jQuery AJAX based Voting or Rating System using Flask and MySQL

Introduction In this post we will see how to create voting or rating system using Flask, MySQL and AJAX. We post tutorials, articles or blogs either on our own blog site or as a guest user to other sites. Sometimes we need to let user rate on our tutorials or articles or blogs so that we know how much that blog is famous or how much that blog is intended to be accepted by readers. In this example I have given one sample content on which you can rate this.…

Continue

How to send bulk emails with attachments using Python and Flask

Introduction In this tutorial I will show you how to send bulk emails with attachments using Python and Flask API. Flask API will be used to build the web based application and using Python’s email library we will send the email to multiple recipients. So sending bulk emails means sending an email to multiple recipients. If you want you may attach multiple files in your email message. For attaching files I have given users option to choose multiple files using browse button. You can hold CTRL key while selecting multiple…

Continue

AJAX jQuery based XChart Example using Python Flask MySQL

Introduction In this example we will see how to display data on XChart using AJAX, jQuery, Python Flask and MySQL. XChart displays different statistical data on different chart types such as column chart, bar chart, line chart, pie chart etc. This tutorial shows step by step so that we can understand how it happens. It displays the data for site visitors log in line chart. I have also put a calendar for date-picker so that you can pick a custom range of dates and get the visitor statistics in xchart.…

Continue

How to deploy Python Flask MySQL based application in Heroku Cloud

Introduction In this example I will show you thorough example on how to deploy Python Flask MySQL based application in Heroku Cloud. I will use free account to use the cloud services from Heroku. I will show you how to import existing MySQL database into Heroku. I will also tell how to turn on/off the app in maintenance mode. I will use the existing application written on Python Flask and MySQL database is used to store data for the application.

Continue