Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
def create_tables():
    from src.db import db
    db.init_app(app)
    db.create_all()
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
 def setUp(self):
     db.create_all()
Ejemplo n.º 5
0
def create_db():
    from src.db import db
    db.create_all()
Ejemplo n.º 6
0
def create_table():
    db.create_all()
Ejemplo n.º 7
0
def create_tables() -> None:
    """
    Creates all the tables (it sees) in a data.db file,
    before the first request.
    """
    db.create_all()
Ejemplo n.º 8
0
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()
Ejemplo n.º 10
0
 def setUp(self):
     db.create_all()
Ejemplo n.º 11
0
def create_db():
    db.create_all()