43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from flask import Flask, g
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_migrate import Migrate
|
|
from flask_login import LoginManager
|
|
from config import Config
|
|
import time
|
|
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
db = SQLAlchemy(app)
|
|
migrate = Migrate(app, db)
|
|
|
|
from app.utils.converters import *
|
|
app.url_map.converters['topicslug'] = TopicSlugConverter
|
|
app.url_map.converters['forum'] = ForumConverter
|
|
|
|
@app.before_request
|
|
def request_time():
|
|
g.request_start_time = time.time()
|
|
g.request_time = lambda: "%.5fs" % (time.time() - g.request_start_time)
|
|
|
|
login = LoginManager(app)
|
|
login.login_view = 'login'
|
|
login.login_message = "Veuillez vous authentifier avant de continuer."
|
|
|
|
|
|
from app import models # IDK why this is here, but it works
|
|
from app.models.comment import Comment
|
|
from app.models.thread import Thread
|
|
from app.models.forum import Forum
|
|
from app.models.topic import Topic
|
|
from app.models.notification import Notification
|
|
|
|
from app.routes import index, search, users # To load routes at initialization
|
|
from app.routes.account import login, account, notification
|
|
from app.routes.admin import index, groups, account, trophies, forums
|
|
from app.routes.forum import index
|
|
|
|
from app.utils import pluralize # To use pluralize into the templates
|
|
from app.utils import date
|
|
from app.utils import is_title
|