Flask is a micro web framework written in Python and based on the Werkzeug toolkit and Jinja2 template engine. It is BSD licensed. ... However, Flask supports extensions that can add application features as if they were implemented in Flask itself. - Wikipedia
Welcome to the new series of Flask. It is very important for Python programmers as it is the way to connect your Python code with front end, in easy words. This will be a series of tutorial covering Flask from basic.
This series will help you learn Flask and will give you enough knowledge that you can build your own websites with Python. As said below you will need basic understanding of HTML, CSS and Python. I will try to explain each line of code in detail so beginners can also follow me in this series. Even if you don't understand those language you can still follow this series but I recommend having some knowledge of them.
Many people will argue between Django and Flask. Most of the time it depends on the type of you are gonna do. There are still some differences between Django and Flask that makes both good. If I tell in easy words, Flask allows us to do any task "our" way while Django restricts us to use "his" way to perform different tasks. Flask gives us for freedom compared to Django but many may argue that Django is still better, Why?. Most of the time Django way is better way but still I like to do things my way so Flask is for me.
When you start coding in Python. you may start with so-called "Command Line Applications" which runs in command line interface. These commands or applications can be run through Shell or Terminal. If you want to build web applications or websites you may need to use frame works and Flask is one of them. Without frameworks like Python it is very hard to connect your Python code with front end but with frameworks it can become alot easier. One of the main advantages of using Flask is that you can still use those Python for loops, variables etc.
Installing Flask is very simple you can do it simply through terminal. Just type pip3 install flask --user and Flask will be installed(It can also ask for password). Make sure you have a code editor installed because you will need it to continue in this series.
After installing Flask, create a new file with any name you want and paste this code.
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
if __name__ == "__main__":
app.run()
Explanation
That was just a simple code in upcoming tutorials you will get more into Flask so stay tuned for that!