Setting up Flask
Today’s goal is to set up your first working Flask application!
Virtual Environments and venv
The term environment is overloaded in computing.
Our goal in this lesson is to first create a virtual environment on our local machine based on something in our repository, then deploy that same repository to the place we are mirroring.
Mirroring an Environment
Set up a Flask Development Environment
Clone a repository:
git clone https://github.iu.edu/i211su2024/REPO_NAME.git
cd REPO_NAME
Create a venv
environment and install dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Check whether flask works correctly:
python -m flask --version
Deploying an Application
Heads up! There’s a typo in the instructions on your GitHub repositories. Use these commands when setting up instead:
As always, swap USERNAME
with your IU username:
ssh USERNAME@silo.luddy.indiana.edu
git clone https://github.iu.edu/i211su2024/USERNAME-i211-project.git ~/cgi-pub/i211-project
git clone https://github.iu.edu/i211su2024/USERNAME-i211-lecture.git ~/cgi-pub/i211-lecture
Deploying a Flask App to the Luddy CGI Server