For initial setup firstly we will install flask. After that we understand to create a hello world program with the help of flask.
To install flask, we will use virtual environment. A virtual environment is a
private copy of the Python interpreter onto which you can install packages
privately, without affecting the global Python interpreter installed in
your
system.
How to install flask with the help of Virtual Environment
Run the following commands step by step for setup
Step 1: Installing virtual environment
For Linux
//Debian, Ubuntu
$ sudo apt-get install python-virtualenv
//CentOS, Fedora
$ sudo yum install python-virtualenv
//Arch
$ sudo pacman -S python-virtualenv
For windows
> mkdir myproject
> cd myproject
> py -3 -m venv venv
Step 2: Activating Virtual Environment
To install flask, firstly we need to activate virtual environment. To do that run the following commands.
For Linux
$ . venv/bin/activate
For windows
> venv\Scripts\activate
Step 3: Installing Flask
After installing virtual environment, install the flask with the help PyPi. Run the following command after activating virtual environment.
(venv) $ pip install Flask
Now, Flask is installed. You may create web apps from it.
0 Comments