def create_default_settings(app): title = app.config["SiteTitle"] settings = DBSiteSettings(title=title, subtitle=app.config["SiteSubTitle"], owner=app.config["OwnerEmail"], version=DBSiteSettings.VERSION) settings.id = 1 from apis import User, Post, Category home = Category.default_category() owner = User.get_user_by_email(app.config["OwnerEmail"]) if not owner: owner = User.create_user(email=app.config["OwnerEmail"], password=app.config["DefaultPassword"], role="Owner") post = Post.get_by_id(1) if not post: Post.create_post(owner, home, title=common.Welcome_Title % title, body=common.Welcome_Post % title) settings.inited = True settings.save() return settings