# install python 3 and dependencies
sudo apt update
sudo apt install -y \
build-essential \
libffi-dev \
libssl-dev \
hadolint \
python3 \
python-dev \
python3-pip \
python3-venv
# ensure python 3 is the default python version
cat >> ~/.bashrc << EOF
# python3 alias
alias python=python3
EOF
python --version
# install ruby for markdown linting
sudo apt install ruby
sudo gem install mdlgit clone git@github.com:robert-7/Course-Enrollment-App.git
cd Course-Enrollment-AppThe app requires a SECRET_KEY environment variable to be set before starting.
This key is used by Flask for session signing and CSRF protection -- it must be
a strong random value and must not be hardcoded or committed to source control.
The optional APP_ENV variable selects the Flask config profile:
APP_ENV=development # default when unset; keeps local HTTP sessions working
APP_ENV=testing # used by pytest
APP_ENV=production # required for HTTPS deployments so session cookies are SecureFLASK_DEBUG is a local development convenience only. Do not set it in ECS
task definitions, SSM parameters, or any production environment.
Run the setup command to generate a .env file with a fresh key automatically:
make setupThis creates a .env file at the project root (already gitignored) with:
# .env
SECRET_KEY=<randomly generated value>Docker Compose automatically loads .env, so make run will pick it up.
If .env already exists, make setup is a no-op -- delete the file first to
regenerate.
# set up virtualenv
python -m venv '.venv'
source .venv/bin/activate
# install requirements
pip install -r requirements-dev.txt
# set up pre-commit so basic linting happens before every commit
pre-commit install
pre-commit run --all-filesTo deactivate or reactivate your virtual environment:
deactivate # deactivates virtualenv
source .venv/bin/activate # reactivates virtualenvTo hop into the mongodb container and inspect the database:
docker compose exec mongodb mongo NOU_Enrollment
db.getCollectionNames()
db.user.find()For a GUI to inspect MongoDB, install Mongo Compass.
After installing Postman, import the Postman collection for the full API setup.