mirror of
https://github.com/skylanix/MamieHenriette.git
synced 2026-02-06 23:10:36 +01:00
Premier jet acces BDD
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
from flask import Flask
|
||||
# from flask_sqlalchemy import SQLAlchemy
|
||||
# import os
|
||||
|
||||
# file_path = os.path.abspath(os.getcwd())+"/todo.db"
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.sql import text
|
||||
|
||||
webapp = Flask(__name__)
|
||||
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+file_path
|
||||
# db = SQLAlchemy(app)
|
||||
webapp.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
|
||||
db = SQLAlchemy(webapp)
|
||||
|
||||
from webapp import routes
|
||||
from webapp import routes
|
||||
|
||||
with webapp.app_context():
|
||||
with open('schema.sql', 'r') as f:
|
||||
sql_script = f.read()
|
||||
db.session.execute(text(sql_script))
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user