Skip to content

Instantly share code, notes, and snippets.

@va7sdf
Last active November 26, 2021 06:11
Show Gist options
  • Save va7sdf/b1e4dc9efe323cc7a86870cc50b1213b to your computer and use it in GitHub Desktop.
Save va7sdf/b1e4dc9efe323cc7a86870cc50b1213b to your computer and use it in GitHub Desktop.
########################################################################
# Script to demonstrate the setup of a workspace; install Flask; and,
# copy examples to workspace.
#
# This script was written for the Victoria Raspberry PiMakers And Others
# Meetup Group presentation on November 27, 2021.
#
# Gordon M. Celesta
# gordo@sdf.lonestar.org
#
# Depends on Demo Magic: https://github.com/paxtonhare/demo-magic
########################################################################
#!/usr/bin/env bash
. demo-magic.sh
TYPE_SPEED=40
DEMO_PROMPT='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
REPO_DIR=/home/gordo/repos/flaskdemo
PIP_DIR=/home/gordo/.cache/pip
cd "/home/gordo/bin"
if [ -d "$REPO_DIR" ]; then
rm -rf "$REPO_DIR"
fi
if [ -d "$PIP_DIR" ]; then
rm -rf "$PIP_DIR"
fi
#clear
########################################################################
p "\n# Verify git, python3, and required modules are installed\n"
pei "dpkg-query -W git python3 python3-pip python3-venv | column -t"
p "\n# Clone repository\n"
pei "git clone https://github.com/va7sdf/vicpimakers-flaskdemos.git $REPO_DIR"
p "\n# Change into this directory\n"
if [ -d $REPO_DIR ]; then
pei "cd $REPO_DIR"
else
exit
fi
p "\n# Which python3 is being used?\n"
pei "which python3"
p "\n# Which Python modules are available?\n"
pei "python3 -m pip list"
p "\n# Create a Python virtual environment\n"
pei "python3 -m venv $REPO_DIR/venv"
p "\n# Initialize the virutal environment\n"
pei "source $REPO_DIR/venv/bin/activate"
p "\n# Now, which python3 is being used?\n"
pei "which python3"
p "\n# Now, which Python modules are available?\n"
pei "python3 -m pip list"
p "\n# Install Flask module and dependencies\n"
pei "python3 -m pip install Flask Flask-WTF"
p "\n# Verify Flask was installed\n"
pei "python3 -m pip list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment