Skip to main content

Posts

Showing posts with the label Flask

Flask 1 - Set Up a Basic App

🍶 Flask is a framework to build websites. Here, we will make a simple blogging website. Below are the steps to start. Install Python  Install Pip  Install Flask Run the following code in Command Line: import flask #TO CHECK IF FLASK IS INSTALLED exit() #TOEXIT FLASK cd inqzit #TO GO TO THE FOLDER Create a python file and name it app_001001_start.py. Add the following code in it. from flask import Flask app = Flask(__name__) @app.route("/") def hello():     return "Hello World!" Run the following code in Command Line: set FLASK_APP=app_001001_start.py #TO START RUNNING THE APPLICATION SERVER set FLASK_DEBUG = 1 #TO AUTO RUN SERVER WHEN FILES UPDATED flask run #TO RUN THE SERVER Go to http://127.0.0.1:5000/ or http://localhost:5000/ in browser. Instead of set FLASK_DEBUG = 1 line, we can add a few lines of code in the python file itself for auto run of server when a file is updated. Add the following code in the file. if __name__=='__main__': app.run(deb...