def create_tables(): """ This lines of code will make sure that before the first call to the database, the `database structure` is being created automatically. :return: """ from src.db import db with app.app_context(): db.init_app(app) db.create_all()
def create_tables(): from src.db import db db.init_app(app) db.create_all()
app = Flask(__name__, template_folder='views') app.config["SECRET_KEY"] = urandom(32) from src.db import db from src.models import categories, users, products, categories_products """ Login manager """ login_manager = LoginManager() login_manager.init_app(app) login_manager.login_message = "Ominaisuus vaatii sisäänkirjautumisen" login_manager.login_view = "index" from src import routes @login_manager.user_loader def load_user(user_id): return users.User.query.get(user_id) from src import encryption try: db.create_all() except: pass
def setUp(self): db.create_all()
def create_db(): from src.db import db db.create_all()
def create_table(): db.create_all()
def create_tables() -> None: """ Creates all the tables (it sees) in a data.db file, before the first request. """ db.create_all()
def create_tables(): from src.db import db with app.app_context(): db.init_app(app) db.create_all()
def create_tables() -> None: """ Creates all the tables (it sees) in a .db file. """ db.create_all()
def create_db(): db.create_all()