UnderCover/flaskr/__init__.py

37 lines
744 B
Python

# Copyright Sage Vaillancourt 2021
import os
from flask import (
Flask, redirect, url_for, render_template, send_from_directory
)
import subprocess
import time
import writing
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
)
if test_config is None:
app.config.from_pyfile('config.py', silent=True)
else:
app.config.from_mapping(test_config)
try:
os.makedirs(app.instance_path)
except OSError:
pass
app.register_blueprint(
writing.writing_blueprint,
#url_prefix='/writing',
)
return app