Browse Source

Fix the populate script

Getty Ritter 1 year ago
parent
commit
9bafa53bbb
2 changed files with 11 additions and 2 deletions
  1. 1 0
      scripts/populate.py
  2. 10 2
      tasks.py

+ 1 - 0
scripts/populate.py

@@ -8,6 +8,7 @@ import lc.request as r
 
 
 def main():
+    c.app.init_db()
     m.create_tables()
 
     u = m.User.get_or_none(name="gdritter")

+ 10 - 2
tasks.py

@@ -65,9 +65,17 @@ def checkfmt(c):
 
 
 @task
-def populate(c):
+def populate(c, port=8080, host="127.0.0.1"):
     """Populate the test database with fake-ish data"""
-    c.run("PYTHONPATH=$(pwd) poetry run python3 ./scripts/populate.py")
+    c.run(
+        "PYTHONPATH=$(pwd) poetry run python3 ./scripts/populate.py",
+        env={
+            "FLASK_APP": "lament-configuration.py",
+            "LC_APP_PATH": f"http://{host}:{port}",
+            "LC_DB_PATH": "test.db",
+            "LC_SECRET_KEY": "TESTING_KEY",
+        },
+    )
 
 
 @task