Flask web application developed Summer of 2021
- MacOS pyenv installation (ensure Brew is installed)
brew update
brew install pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrc
pyenv --version
- cd into root and create a virtual environment:
python3 -m venv myenv
- Activate environment and install application dependencies:
source myenv/bin/activate
pip3 install -r requirements.txt
- Create local database
source myenv/bin/activate
python
from application import create_app, db, bcrypt
-
from application.models import User
app = create_app()
with app.app_context():
db.create_all()
hashed_pw = bcrypt.generate_password_hash("ENTER_PASSWORD_HERE").decode("utf-8")
user = User(username='Namehere', email='[email protected]', password=hashed_pw)
db.session.add(user)
db.session.commit()
Verify with User.query.all()
- exit()
- python3 run_app.py