From d2f93359b034e19e649f07c48a62d9eefa89f4ef Mon Sep 17 00:00:00 2001 From: lza_menace Date: Sun, 9 Aug 2020 22:47:14 -0700 Subject: [PATCH] update init to create folder structure --- suchwow/app.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/suchwow/app.py b/suchwow/app.py index d8fee75..1644722 100644 --- a/suchwow/app.py +++ b/suchwow/app.py @@ -1,7 +1,9 @@ import json +from os import makedirs from flask import Flask, request, session from flask import render_template, flash from flask_session import Session +from suchwow import config from suchwow.models import Post, Profile, Comment, Notification, db from suchwow.routes import auth, comment, post, profile from suchwow.utils.decorators import login_required @@ -37,8 +39,13 @@ def about(): def not_found(error): return "nothin there, brah" -@app.cli.command("dbinit") -def dbinit(): +@app.cli.command("init") +def init(): + # create subdirs + for i in ["uploads", "db", "wallet"]: + makedirs(f"{config.DATA_FOLDER}/{i}", exist_ok=True) + + # init db db.create_tables([Post, Profile, Comment, Notification]) if __name__ == "__main__":