Skip to content
Related Articles
Open in App
Not now

Related Articles

Flask Development Server

Improve Article
Save Article
  • Last Updated : 22 Dec, 2021
Improve Article
Save Article

What is Flask?

Flask is a micro-web-framework based on python. Micro-framework is normally a framework with little to no external dependencies on libraries. Though being a micro-framework Flask is as effective as any other web framework because of its wide range of available python libraries like SQLAlchemy, Flask-Migrate, etc. In this article, we will be discussing what a development server is and why is it used.

What is a development server?

A development server is a server that is used in the development, testing of programs, websites, software, or applications by developers. It provides a runtime environment as well as all hardware/software utilities that are required for program debugging and development.

You can use a development server to check whether your web application is working as expected or not. In flask when debug settings are set to true, you can also use the development server to debug your application.

In this article, we will create a single-page flask-based web application and explain the different methods by which you can run your development server.

Creating Flask Web Application –

Module Installation: To install flask using pip(package installer for python) run the following command:

pip install flask

Example: Following is the code for a simple flask application that has a single page and we will use the development server to check whether the page is served in the application as expected.

from flask import Flask, render_template

app = Flask(__name__)

# Debug setting set to true
app.debug = True

def index():
    return "Greetings from GeeksforGeeks"

if __name__ == '__main__':

Starting development server: Starting a development server in the flask using the following command.

python <name>.py

Here <name> is the name of the file where the instance of the flask app has been created and the function exists. By convention, this file is mostly named app, thus the command will be shown below.


The development server will open up on and you will see the following output on your browser screen.

Greetings from GeeksforGeeks

Lazy Loading Or Eager Loading – When using the development server it will continue to run even if you introduce syntax errors or other initialization errors into the code. Accessing the site with the errors will show the interactive debugger for the error, rather than crashing the server. This feature is called lazy-loading. In simpler words in lazy-loading, the server does not crash even if something goes wrong in your application rather an informative debugger page loads up.

To activate lazy loading you can modify the command as follows:

python --lazy-loading

Now, in eager loading, if an error is present in the application code or some probable section of the application, then rather than loading the interactive debugger the development server fails with a detailed traceback of the error. 

To activate eager loading you can modify the command as follows:

python --eager-loading


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!