My app, based on Dash (https://plot.ly/dash/), stopped working after I updated my libraries by using https://pypi.org/project/pur
I didn't pay attention and gunicorn upgraded from v19.9.0
to v20.0.0
.
There is clearly a breaking change but I don't know how to address it. Any thought?
PS: I have read this post but it didn't help me : https://github.com/benoitc/gunicorn/issues/2159
thank in advance for your help
The Error
Failed to find application object 'app.server' in 'index'
[INFO] Shutting down: Master
[INFO] Reason: App failed to load.
gunicorn command : working version if v19.9.0 but fails with v20.0.0
gunicorn --bind=0.0.0.0 --timeout 600 index:app.server
index.py
# -*- coding: utf-8 -*-
from dash.dependencies import Input, Output
from webapp import app
import dash_core_components as dcc
import dash_html_components as html
import logging
import os
import sys
from pages import (
overview,
)
try:
app.index_string = open(os.path.join("html", "index.html")).read()
except OSError:
logging.exception("load (%d): index.html not found" %
sys.exc_info()[-1].tb_lineno)
sys.exit()
# Describe the layout/ UI of the app
app.layout = html.Div([
dcc.Location(id="url", refresh=False),
html.Div(id="page-content")
])
# Update page
@app.callback(Output("page-content", "children"),
[Input("url", "pathname")])
def display_page(pathname):
if pathname == "/a-service/overview":
return overview.layout
else:
return overview.layout
if __name__ == "__main__":
app.run_server(debug=True, port=8051)
webapp.py
# -*- coding: utf-8 -*-
import dash
description = "a description"
title = "a title"
creator = "@altf1be"
app = dash.Dash(
__name__,
meta_tags=[
{"name": "viewport", "content": "width=device-width, initial-scale=1"},
{"name": "description", "content": description},
{"name": "twitter:description", "content": description},
{"property": "og:title", "content": description},
{"name": "twitter:creator", "content": creator}
]
)
server = app.server
app.config.suppress_callback_exceptions = True
can you start gunicorn with the debug level to see where the application is failing?
Exact same issue here - I'll take a closer look soon
I think it related to this change: https://github.com/benoitc/gunicorn/commit/3701ad9f26a7a4c0a081dfd0f6e97ecb272de515#diff-0b90f794c3e9742c45bf484505e3db8dR377
same issue as: https://github.com/benoitc/gunicorn/issues/2159
Try using a simple name instead of expecting gunicorn to traverse into objects. For example, webapp:server
.
Try using a simple name instead of expecting gunicorn to traverse into objects. For example,
webapp:server
.
This also worked as a fix for me (changed gunicorn app:app.server
to gunicorn app:server
after adding a line to app.py
that declared server = app.server
)
I assume from now on this kind of thing will also never work:
gunicorn module.app:create_app()
Hi folks, here are the results of diverse attempts:
Still need to test those combinations:
@Abdelkrim with latest master?
@benoitc, I am running the v20.0.0 and not your latest update I am afraid
when will the latest update be available by using pip?
I do use Azure pipeline to deploy the web app and I don't know how to force the usage of the latest version of the code hosted on gituhub instead of using the regular requirements.txt
QUESTION: should I just wait a new version number? ... I'll deploy a new version of the code and give you my feedback (it requires ~1 hour => around 1:00am Brussels time)
if you can test with the latest master that would help :) i will see if i reproduce it later this morning otherwise
@benoitc I can't access to the machine using ssh and force the usage of the latest version of gunicorn.
QUESTION : do you know how/when the latest release will be available on PyPi? I see this : Last released: Nov 9, 2019 on https://pypi.org/project/gunicorn
this will greatly facilitate my testing as I don't have access to any linux machine besides the Linux web apps on Azure :-(
Kind regards & thank you all for the time you have invested in this case
@Abdelkrim the following commandline works:
gunicorn -w3 --pythonpath="/path/to/gunicorn/examples" deep.test:app
with the following example: https://github.com/benoitc/gunicorn/tree/master/examples/deep . I'm closing the issue then. The release will land today hopefully.
@benoitc thank you, I'm waiting for the latest release and I'll give you my feedback.
many thanks for your help
A.
Confirmed fixed with the latest master, thanks!
(Although it wouldn't have been a big deal to adapt in our case if it was an architectural decision)
Edit: A fun fact, I happened to test with Git master just a couple of minutes before 20.0.1 hit PyPi :slightly_smiling_face:
@benoitc @davidism I wanted to thank you for the support. the app works using gunicorn v20
Most helpful comment
Confirmed fixed with the latest master, thanks!
(Although it wouldn't have been a big deal to adapt in our case if it was an architectural decision)
Edit: A fun fact, I happened to test with Git master just a couple of minutes before 20.0.1 hit PyPi :slightly_smiling_face: