13 C
Texas

How to install FLASK in Windows 10

Today we will see how to install FLASK in Windows 10. This is a framework written in Python designed to create web applications. Also, it offers to do it quickly and without having to enter and edit many lines of code. It is based on the WSGI specification by Werkzeug and the Jinja2 template engine. On the other hand, it has a BSD license. Some of its features are the following:

  • It is based on Unicode
  • WSGI compliant
  • Allows the execution of individual tests
  • It has development servers and debugging features
  • Use Jinja2 template styles
  • Allows the creation of secure cookies for sites

Prerequisite

As mentioned, this is an application written in Python. Consequently, it is essential to have this language installed. To know how to do it, see our tutorial.

How to download and install Flask in Windows 10. Step by step.

In the first place, it is necessary to create a folder where you will save the configuration of the app. With this in mind, we will create it inside Documents and call it my_flask.

Then open a CMD as an administrator from the folder location and run the following command:

- Advertisement -
py -m venv env

With this command we have created the virtual environment of Flask. In effect, all you have to do is go to the folder and look at the content.

Back to the terminal, please run the following command to activate the environment:

env\Scripts\activate

Now, install Flask with the following command:

pip install flask
Installing Flask on Windows 10
Installing Flask on Windows 10

Once Flask is downloaded and installed, the wizard recommends updating the pip. With this in mind, run the following command:

python.exe -m pip install --upgrade pip
Updating the PIP version
Updating the PIP version

Creating the configuration file.

Now it’s time to create an app.py file. Consequently, some advanced text editor like Notepad++ is recommended. Finally, save it in the newly created folder.

Creating the app.py file
Creating the app.py file

Then, please establish the application with the following order:

set FLASK_APP=app.py

Then open the app.py file and add the following lines:

from flask import Flask
app = Flask(name)
@app.route('/')
def index():
return '<h1>Hello</h1>'
Editing the configuration file
Editing the configuration file

To run this environment go to the terminal and there run:

flask run

Then, select the assigned IP address in the terminal. Then open it in any browser.

Flask application running successfully in a browser
Flask application running successfully in a browser

Ultimately we have seen how you install Flask on Windows 10. Besides, it is written in python so it has a great support. See you later!

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article