app.db has been added, acting as our database. I believe for the demo, we just have a small example, which can be this.
app.db currently has one SQLite table, being Word, populated with words from words.txt (I have left words.txt there just so we can see the words easily for ourselves)
in models.py, you can see the Word table defined (this may need to be refined, just a start)
in routes.py, the get-word endpoint retrieves a random word from the database
in draw.js, fetchWordAndStartGame() uses ajax to make a call to the get-word endpoint, retrieving random word and displaying it
Other database related things:
after adding a model to models.py, run the command 'flask db migrate' and 'flask db upgrade', this should (I think) update the db accordingly (see databases lecture, also explains how to manually add data to the db once you have migrated the general structure from the model)
migrations folder just tracks these migrations, we shouldn't need to alter it manually at all
Hope this makes sense. Shouldn't take long to finish setting up the database now (with extra models and data).
Finished Issue #16
Main contributions:
Other database related things:
Hope this makes sense. Shouldn't take long to finish setting up the database now (with extra models and data).