def init_db(): db.create_all() # TODO: configure default user here db.session.add(User(username="******", password="******")) db.session.add(User(username="******", password="******")) db.session.add(User(username="******", password="******")) db.session.commit()
def install(): # Create database db.drop_all() db.create_all() print("...Database successfuly installed") # Add fixtures add_country() add_state_order()
# Configuration of Flask application from webserver import app from webserver.config import TestingConfig app.config.from_object(TestingConfig) # Configure DataBase and create it from webserver import db db.initialize(app.config['SQLALCHEMY_DATABASE_URI']) db.create_all() # Import models from webserver.models import Address, Client, Country, Dish, Entrepreneur, Livreur, LineOrder, Menu, Order, Personne, Restaurant, Restaurateur, StateOrder # Import others import datetime # Builders and deleters ################################################ # Address def build_address(id, address="1010 Avenue de la banquise", zipcode="H1S1R1", city="Montreal", country=None, personne_id=None): """ Builder to create an address in database """ if country is None: country = build_country(id=id)
# Configuration of Flask application from webserver import app from webserver.config import TestingConfig app.config.from_object(TestingConfig) # Configure DataBase and create it from webserver import db db.initialize(app.config["SQLALCHEMY_DATABASE_URI"]) db.create_all() # Import models from webserver.models import ( Address, Client, Country, Dish, Entrepreneur, Livreur, LineOrder, Menu, Order, Personne, Restaurant, Restaurateur, StateOrder, ) # Import others import datetime