
This shell script file helps launch the Gunicorn server. A common choice for this web server is Gunicorn. This file contains all the python packages one would need to install to run this app.Īlthough Flask has a built-in web server, it is unsuitable for production and needs to be installed behind a real web server that can connect with Flask via the WSGI protocol. In the templates folder, the file ‘index.html’ contains a simple template comprising a single line of text as a heading. This python script is for creating a flask app that, when run, renders the template contained in ‘index.html’. Let us first understand the files present in this repo. This repo can be cloned to your local, which could be used to build the docker image. I have created a GitHub repo that has a simple flask app. To further simplify the process and avoid manually writing Docker commands, we use the Docker extension available in VS Code that creates an automatic template consisting of those commands. This article is a hands-on guide for building and running docker images of a generic flask app.

Additionally, the containers you develop would be highly portable, allowing you to easily move from local development to a supercomputing cluster. You could be sure of the reproducibility of your application, meaning that you wouldn’t have to deal with any “it doesn’t work on my machine” issues. This helps make the docker container lightweight along with enhanced performance. It allows the applications to use the same kernel as the system (host) they are running on. One can think of Docker as a virtual machine without any operating system.

Simply put, if your job as a data scientist requires developing applications, make it easy for you to create, deploy and run them by providing isolated environments encapsulating all the needed dependencies. Dockers help prevent this by ensuring the application runs on any machine if it works on yours. More often than not, developers run into issues of an application running on one machine versus not running on another.

vscode folder.This article was published as a part of the Data Science Blogathon. Then, follow the Flask Tutorial from the VS Code docs.īasically, you'll need to create a launch.json file in your workspace's. Start with installing the Python extension for VS Code, to add support for " debugging of a number of types of Python applications, which includes Flask. VS Code's launch.json supports a number of options, including the setting of environment variables that your Flask app needs. For Flask apps, you can create a launch.json configuration that will run your Flask app using VS Code's debugger.
