diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-03-18 17:43:30 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-03-18 17:43:30 +0000 |
commit | 366a2302d092c12f388f0eb8efb4faaa3acd3303 (patch) | |
tree | 070f3ef21b04bd716b9136a827d9fe7b90c32e2c /setup.py | |
download | cheatdb-366a2302d092c12f388f0eb8efb4faaa3acd3303.tar.xz |
Initial commit
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0ba2b5a --- /dev/null +++ b/setup.py @@ -0,0 +1,17 @@ +import os, datetime + +delete_db = False + +if delete_db and os.path.isfile("app/data.sqlite"): + os.remove("app/data.sqlite") + +if not os.path.isfile("app/data.sqlite"): + from app import models + + print("Creating database tables...") + models.db.create_all() + + print("Filling database...") + models.db.session.commit() +else: + print("Database already exists") |