2019-08-20 18:04:10 +02:00
|
|
|
from flask import Flask, g
|
2018-02-23 23:34:06 +01:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from flask_migrate import Migrate
|
|
|
|
from flask_login import LoginManager
|
|
|
|
from config import Config
|
2019-08-20 18:04:10 +02:00
|
|
|
import time
|
|
|
|
|
2018-02-23 23:34:06 +01:00
|
|
|
|
|
|
|
app = Flask(__name__)
|
|
|
|
app.config.from_object(Config)
|
|
|
|
db = SQLAlchemy(app)
|
|
|
|
migrate = Migrate(app, db)
|
2019-02-02 17:34:41 +01:00
|
|
|
|
2019-08-20 18:04:10 +02:00
|
|
|
|
|
|
|
@app.before_request
|
|
|
|
def request_time():
|
|
|
|
g.request_start_time = time.time()
|
|
|
|
g.request_time = lambda: "%.5fs" % (time.time() - g.request_start_time)
|
|
|
|
|
2018-02-23 23:34:06 +01:00
|
|
|
login = LoginManager(app)
|
|
|
|
login.login_view = 'login'
|
2019-02-03 16:20:05 +01:00
|
|
|
login.login_message = "Veuillez vous authentifier avant de continuer."
|
2018-02-23 23:34:06 +01:00
|
|
|
|
2019-08-20 18:04:10 +02:00
|
|
|
|
2019-06-06 01:06:46 +02:00
|
|
|
from app import models # IDK why this is here, but it works
|
2019-08-21 16:50:23 +02:00
|
|
|
from app.models.comment import Comment
|
|
|
|
from app.models.thread import Thread
|
|
|
|
from app.models.forum import Forum
|
2019-09-01 12:30:41 +02:00
|
|
|
from app.models.notification import Notification
|
2019-06-06 02:11:48 +02:00
|
|
|
from app.routes import index, search, users # To load routes at initialization
|
2019-09-01 12:30:41 +02:00
|
|
|
from app.routes.account import login, account, notification
|
2019-06-06 23:24:14 +02:00
|
|
|
from app.routes.admin import index, groups, account, trophies
|
2019-06-06 01:06:46 +02:00
|
|
|
from app.utils import pluralize # To use pluralize into the templates
|
2019-06-11 00:15:23 +02:00
|
|
|
from app.utils import is_title
|