Lab: running Flask on stearns
Nothing to hand in
This lab is a quick walkthrough of how to run your Flask code on a Carleton server instead of just your local machine.
What to do
- Open VS Code.
- Use the bottom-left-corner icon to login to your Carleton account on stearns.mathcs.carleton.edu and open your cs257 folder, like you did in this lab.
- Open a terminal in VS Code. Try executing
pwd; it should show you the path to your cs257 directory on stearns. This is just a way to make sure the terminal is putting you where you think it should. Also, tryhostnamefor a more explicit verification of what machine you're on. Get a clone of my cs257 repository:
git clone https://github.com/ondich/cs257-2025-spring.git- Open your email. I have sent you four pieces of information: your database username, your database password, and two ports that you are allowed to use. The database username should be the same as your regular user name, but check to make. Today, we will only use the ports.
Go into my flask directory and run the sample flask program:
cd flask python3 flask_sample.py stearns.mathcs.carleton.edu YOUR_FIRST_PORT- Open a browser and go to
http://stearns.mathcs.carleton.edu:YOUR_FIRST_PORT/. Do you see the greeting you expect? Try/helpor/actor/adamsto see if they work, too. - Done? Click the bottom left of VS Code to logout of stearns.