Getting Started With Flask

August 16, 2019 Liquid Web

In this video tutorial, we will be showing you how to get started with Flask and build a web application. Flask is a python microenvironment designed to be lightweight and offers you the freedom to create web applications without limitations on the modules and packages you want to use and, the methods and structure you want to follow.

Commands used: 

pip 3 install virtual env virtualenv --python=python3
python-tutorial source bin/activate pip
install flask
touch flask-tut.py
vim flask-tut.py
Add the following code to the file flask-tut.py:
# Import the Flask package from flask import Flask
# Initialize Flask app = Flask(__name__)
# Define the index route @app.route("/") def index(): return "Hello from Flask!"
# Run Flask if the __name__ variable is equal to __main__ if __name__ == "__main__": app.run()
:wq to save the file.

Now execute the file by running:

python3 flask-tut.py (flask_tutorial) Johns-MBP:flask_tutorial john$ python flask_tut.py * Serving Flask app "flask_tut" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off< * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) All requests and response codes will be logged to the output from the running server in the terminal.

The related article for this video can be found here: https://www.liquidweb.com/kb/getting-started-with-flask/ ‎

For more information about this and other topics, visit us at https://www.liquidweb.com/kb/ or https://www.youtube.com/user/LiquidWebInc 

Check out our full line of applicable products here! https://www.liquidweb.com/products/

Video by: John Long

About the Author

Liquid Web

Liquid Web powers online content, commerce, and potential for SMB entrepreneurs and the designers, developers and digital agencies who create for them. Sign up for our newsletter to stay up to date with our latest content.

More Content by Liquid Web
Previous Video
Enable Root Login via SSH
Enable Root Login via SSH

Normally, SSH root logins are disabled by default in new Ubuntu installs. In this video, we outline how to ...

Next Video
How to Delete A Database In MySQL/MariaDB
How to Delete A Database In MySQL/MariaDB

In this video, we look at how to list the databases as well as how to delete a MySQL/MariaDB database from ...

Learn What Qualities to Look for in Your Next Host in Our New Guide!

Download Now