1.) I am using sqlalchemy (currently with sqlite) as database for my (multipage)-dashapps. I was just wondering if this is the correct way to do this:
inside init.py:
import os
import flask
from flask import Flask
import dash
import dash_html_components as html
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
import dash_bootstrap_components as dbc
server = flask.Flask(__name__)
server.config['SECRET_KEY'] = 'mysecretkey'
basedir = os.path.abspath(os.path.dirname(__file__))
server.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
server.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(server)
Migrate(server,db)
external_stylesheets = [dbc.themes.BOOTSTRAP]
app = dash.Dash(
__name__,
external_stylesheets=external_stylesheets,
server=server,
)
app.config.suppress_callback_exceptions = True
A problem I am facing is that my DB file gets corrupted (malfunction error) when I start to experiment with the tables (e.g. adding 50+ entries) and I have to set up the database from scratch again. so I am wondering if it is because I have a mistake in the initialization process?
2.) Another Question: Is there a particular database that is recommended to use with Dash ? (For Production Apps that multiple user can use at the same time)?
Thank You!!