Install Virtual Environment
Python 3 comes with a virtual environment module called venv preinstalled. If you have Python 3 installed, skip this step.
If you have Python 2, follow the given instructions:
py -2 -m pip install virtualenv
sudo apt install python-virtualenv
Create an Environment 'env'
Run the commands:
For Python 3:
py -3 -m venv env
For Python 2:
py -2 -m virtualenv env
For Python 3:
python3 -m venv env
For Python 2:
python -m virtualenv env
Activate the Environment
Run the commands:
env\Scripts\Activate.ps1
source env/bin/activate
Install Flask
python -m pip install flask
Set the FLASK_APP Environment Variable.
Run the commands:
setx FLASK_APP=app
setx FLASK_ENV=development
export FLASK_APP=app
export FLASK_ENV=development
Run the Flask App
flask run
Git Commands
git init
- Initializes a git repository
git pull https://github.com/ShinuShaju/flask-app
- pulls the code from remote repository
git add .
or git add filename
- adds a file/files to the git staging area
git commit -m "commit message in double quotes"
git branch -m main
- sets main branch as main
git remote add origin https://github.com/ShinuShaju/flask-app
git remote set-url origin https://github.com/ShinuShaju/flask-app
git push -u origin main
- push to a remote git repository