A simple way to log and study python tidbits.
-
Clone this repository (fork it first if you want to deploy to Heroku):
git clone https://github.com/chrisluedtke/pyflashcards
-
Create flashcard markdown files in the
cards
directory. See samples for formatting. -
Within project repository, create a virtual environment:
python -m venv venv
-
Activate the environment:
venv\Scripts\activate
-
Install requirements:
pip install -r requirements_dev.txt
-
Create a
.env
with contents:FLASK_APP=pyflashcards:APP FLASK_ENV="development" DATABASE_URL="sqlite:///db.sqlite3" SECRET_KEY="you-will-never-guess"
-
Run the web app (the database will be initialized automatically):
flask run
-
Navigate to the locally served page, typically
http://localhost:5000/
To update cards in the app after editing the markdown decks, simply run:
flask shell
create_or_update_decks()
Note: If a card's question and answer have been updated, this will create a new card. If just the question or just the answer have changed, the original card will be updated.
- Clone this repository
- Within project repository, build the image
docker build -t pyflashcards:latest .
- Run the container
docker run -p 8000:8000 pyflashcards:latest
- Fork this repository to your GitHub account.
- On Heroku, connect your GitHub account, and create an app that syncs with your forked repository.
- Ensure you have the following environment variales on heroku:
FLASK_APP=pyflashcards:APP FLASK_ENV=production DATABASE_URL= SECRET_KEY=
- The database will initialize automatically. To reset the production database, run this from your local command line:
heroku run flask shell -a pyflashcards DB.drop_all() DB.create_all() create_or_update_decks() quit()