I’m trying to run an app with both Dash and Flask apps on Azure.
I get an error “application must be callable”, which led me to a solution that suggested i need to add
gunicorn app:server -b localhost:8000
or
gunicorn app:app.server -b localhost:8000
to the startup file, both of which simply time out.
Locally, it runs fine with server.run()
What I think is the relevant code is below:
server = Flask(name)
server.config.from_object(Config)
db = SQLAlchemy(server)
migrate = Migrate(server, db)
# N.B.: Import has to come after db is defined and before shell context
from Models import *
# Give shell context for easier account management during dev
@server.shell_context_processor
def make_shell_context():
return {‘db’: db, ‘Users’: Users}
@server.route(’/’)
@server.route(’/home’)
@server.route(’/index’)
def index():
return render_template(‘index.html’)
@server.route(’/transcription/’, methods=[‘POST’, ‘GET’])
@login_required
def transcription():
return render_template(‘transcription.html’)
app = Dash(name=‘dashboard’, url_base_pathname=’/dashboard/’, server=server,
external_stylesheets=[dbc.themes.BOOTSTRAP])
app.scripts.config.serve_locally = True