33 lines
758 B
Python

import os
from flask import Flask, redirect, url_for, render_template
from dotenv import load_dotenv
# Instead of turning 'lookup' into a Blueprint, maybe I could make a history of previous lookups a Blueprint?
def create_app(test_config=None):
app = Flask(__name__)
app.config.from_pyfile("config.py")
load_dotenv()
app.secret_key = os.getenv("SECRET_KEY")
if test_config is None:
app.config.from_pyfile("config.py", silent=True)
else:
app.config.update(test_config)
try:
os.makedirs(app.instance_path)
except OSError:
pass
@app.route("/")
def index():
return render_template("index.html")
from . import lookup
app.register_blueprint(lookup.bp)
return app