blob: df7185b8e26165a350d42243e4f807d04ce8faa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# boilerplate boilerplate boilerplate
# yay
from flask import Flask
from .db import get_db
import os
def create_app():
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY="dev",
DATABASE=os.path.join(app.instance_path, 'database.db'),
)
app.config.from_pyfile("config.py",silent=True)
try:
os.makedirs(app.instance_path)
except OSError:
pass
from . import db
db.init_app(app)
from . import auth
app.register_blueprint(auth.bp)
from . import forum
app.register_blueprint(forum.bp)
from . import thread
app.register_blueprint(thread.bp)
@app.route("/")
def main():
return "the"
@app.route("/b")
def b():
db=get_db()
return str(db.execute("select 2 + 2;").fetchone()[0])
return app
|