
Welcome!
Everything is fine.
Flask, PyMySQL, and Virtualenvs
Our basic infrastructure would conventionally look like this. (Note
that I've used MySQLdb
as the Python package; we'll use PyMySQL
and cs304dbi
.)

venv
and templates
If one were to have several such apps, the conventional approach would be to make them all separate:

- This allows them to be completely independent, but
- doesn't allow for any sharing of Python packages, and
- requires creating a new venv and re-installing Python packages whenever we want a new project.
Instead, since all our work is similar and related, let's share a single virtual environment:

Working on a Project¶
When we start working on a project (either for the first time or continuing work we did earlier), we do:
cd ~/cs304
source venv/bin/activate
cd project
python app.py
Alternatively:
source ~/cs304/venv/bin/activate
cd cs304/project
python app.py
BTW, I strongly suggest that we name the "main" python file app.py
. It
just makes it a little easier for me and for the graders to figure out
which python file we have to run.
Copying a Project¶
With this new structure, copying a project becomes much easier. For example, to copy hwk3 to hwk4 (this preserves hwk3 for grading purposes while you start working on hwk4), do the following:
cd ~/cs304
cp -r hwk3 hwk4