In this project I'm learning the basic concepts of Flask Framework and write down the basic things like:
- how to create vartual env
- How to insall flask?
- How to run flask
- how to activate development mode
working with creating vertual enviornment is good practice beacuse for that have few important points:
- all setup and package realted fils only ristrict to this repository
- when every share this to others will work because all related files are available
- if vritual environment not created then all the realated packages and setups will storn on the main system directory which slow down the system.
for creating the virtual environment run this common on the directory where you want this:
py -3 -m venv venv
Note: here first venv is keyword and second venv is the name of directory of virtual envionment in which all the related packeds will store
we install the falsk using pip package
pip install flask
when create the first flask python file and want to run that follow this:
set FLASK_APP=hello
flask run
Note: by defaut it rungs on http://127.0.0.1:5000/ also on 1st line hello is the name of the flask app
its good practice to set the development mode when working on the project and when want to make it public don't forget to set the production mode. Because on development mode we get all the problems with details which we don't want to show users thats why on public domain make the mode production will help to hide the any problem if occure.
set FLASK_ENV=development
flask run
Note: here on 1st line set the enviornmetna and on 2nd line run the flask.