+ import + db + debugging

main
jgenero 3 years ago
parent adba73e4c7
commit 93e6b90be0

@ -1,27 +1,31 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
from flask import Flask
# from flask_sqlalchemy import SQLAlchemy
import os # module permettant de communiquer avec le système d'exploitation sous-jacent.
from playhouse.sqlite_ext import SqliteExtDatabase
from .debugger import initialize_flask_server_debugger_if_needed
chemin_actuel = os.path.dirname(os.path.abspath(__file__)) # stockage du chemin du fichier courant
templates = os.path.join(chemin_actuel, "templates") # stockage du chemin vers les templates
statics = os.path.join(chemin_actuel, "static") # stockage du chemin vers les statics
APPPATH = os.path.dirname(os.path.abspath(__file__))
templates = os.path.join(APPPATH, "templates")
statics = os.path.join(APPPATH, "static")
app = Flask(
"Application",
template_folder=templates,
static_folder=statics,
) # instantiation de l'application dans la variable app et définition des dossiers templates et
# statics en fonction des chemins os définis au-dessus.
)
# DB configuration
app.config["DATABASE"] = os.path.join(APPPATH, ".", "actes_princiers.db")
db = SqliteExtDatabase(app.config["DATABASE"], pragmas=[("journal_mode", "wal")])
# Configuration de la base de donnée
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///./corpus.sqlite'
# stockage de la base dans l'objet db
# db = SQLAlchemy(app)
# Enables debugging in VS Code if DEBUG env var is set
_debugging = initialize_flask_server_debugger_if_needed()
# Import de la route principale depuis le fichier routes.py
from .routes import home

Loading…
Cancel
Save