Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Flask Templates
  • Jinja2
  • Flask-REST API
  • Python SQLAlchemy
  • Flask Bcrypt
  • Flask Cookies
  • Json
  • Postman
  • Django
  • Flask Projects
  • Flask Interview Questions
  • MongoDB
  • Python MongoDB
  • Python Database
  • ReactJs
  • Vue.Js
Open In App
Next Article:
Flask Development Server
Next article icon

Flask Development Server

Last Updated : 10 Apr, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Filename: app.py python
from flask import Flask, render_template  app = Flask(__name__)  # Debug setting set to true app.debug = True  @app.route('/') def index():     return "Greetings from GeeksforGeeks"  if __name__ == '__main__':     app.run() 

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 app.run() function exists. By convention, this file is mostly named app, thus the command will be shown below.

python app.py

The development server will open up on http://127.0.0.1:5000/ 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 app.py --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 app.py --eager-loading

Reference: https://flask.palletsprojects.com/en/2.0.x/


Next Article
Flask Development Server

A

amanjha7151
Improve
Article Tags :
  • Python
  • Web Technologies
  • Python Flask
Practice Tags :
  • python

Similar Reads

    Fullstack Web Development
    Fullstack web development refers to the practice of building web applications that encompass both frontend and backend components. A full-stack developer is proficient in frontend technologies, such as HTML, CSS, and JavaScript, as well as backend technologies, such as server-side programming langua
    5 min read
    Introduction to Web development using Flask
    Flask is a lightweight and flexible web framework for Python. It's designed to make getting started with web development quick and easy, while still being powerful enough to build complex web applications. It is an API of Python that allows us to build web applications. It was developed by Armin Ron
    10 min read
    Python for Web Development
    To excel in web development with Python, you need to master key concepts, frameworks, tools, and deployment strategies. This comprehensive roadmap provides a step-by-step approach to mastering Python web development. It covers everything from the fundamentals to advanced concepts like API design, se
    4 min read
    Full Stack Development Tools [2025 Updated]
    Full stack development involves working on both the front-end (client side) and back-end (server side) of a web application. It requires a comprehensive set of tools to handle all aspects of web application, from the user interface to the server-side logic and data storage (database). We will go thr
    10 min read
    Flask - Role Based Access Control
    Role-Based Access Control (RBAC) is a security mechanism that restricts user access based on their roles within an application. Instead of assigning permissions to individual users, RBAC groups users into roles and each role has specific permissions.For example, in a Flask app, we might have roles l
    9 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences