Message: WARNING: This is a development server. Do not use it in a production deployment

Hello,
I am trying to practice first example in tutorial and I received following error message:

  • Serving Flask app “main” (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on

Where is the problem? What I need to do?

1 Like

Hi @maralica. There is no issue there if you are working on this application in a development environment (i.e. just for yourself). If you go to the suggested site/port when the command is running (I think it is: http://127.0.0.1:8050/), you should see the application that you’ve created. The warning message that is displayed to you is only relevant when you are serving your dash application to others.

2 Likes

Hello,
Thanks you for your answer but it is not possible for me to connect to that site.
Do I have to set something in Ubuntu Linux OS?

Hi - I’m sorry but I only run MacOS so I’m not familiar with any Ubuntu-specific comments but make sure that you check that link while your app is actively running in the terminal? If that doesn’t work, then can you paste your code, what you see in your terminal log, and what your exact process is here in another comment? Thanks.

This is my code:
import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()
colors = {
‘background’: ‘#111111’,
‘text’: ‘#7FDBFF
}
app.layout = html.Div(style={‘backgroundColor’: colors[‘background’]}, children=[
html.H1(
children=‘Hello Dash’,
style={
‘textAlign’: ‘center’,
‘color’: colors[‘text’]
}
),
html.Div(children=‘Dash: A web application framework for Python.’, style={
‘textAlign’: ‘center’,
‘color’: colors[‘text’]
}),
dcc.Graph(
id=‘Graph1’,
figure={
‘data’: [
{‘x’: [1, 2, 3], ‘y’: [4, 1, 2], ‘type’: ‘bar’, ‘name’: ‘SF’},
{‘x’: [1, 2, 3], ‘y’: [2, 4, 5], ‘type’: ‘bar’, ‘name’: u’Montréal’},
],
‘layout’: {
‘plot_bgcolor’: colors[‘background’],
‘paper_bgcolor’: colors[‘background’],
‘font’: {
‘color’: colors[‘text’]
}
}
}
)
])
if name == ‘main’:
app.run_server(debug=True)

Output from Jupyter notebook:
Dash is running on http://127.0.0.1:8050/

Dash is running on http://127.0.0.1:8050/

  • Serving Flask app “main” (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: on

OSError Traceback (most recent call last)
in
1 if name == ‘main’:
----> 2 app.run_server(debug=True)

~/anaconda3/lib/python3.8/site-packages/dash/dash.py in run_server(self, host, port, proxy, debug, dev_tools_ui, dev_tools_props_check, dev_tools_serve_dev_bundles, dev_tools_hot_reload, dev_tools_hot_reload_interval, dev_tools_hot_reload_watch_interval, dev_tools_hot_reload_max_retry, dev_tools_silence_routes_logging, dev_tools_prune_errors, **flask_run_options)
1715 self.logger.info(“Dash is running on %s://%s%s%s\n”, *display_url)
1716
→ 1717 self.server.run(host=host, port=port, debug=debug, **flask_run_options)

~/anaconda3/lib/python3.8/site-packages/flask/app.py in run(self, host, port, debug, load_dotenv, **options)
988
989 try:
→ 990 run_simple(host, port, self, **options)
991 finally:
992 # reset the first request information if the development server

~/anaconda3/lib/python3.8/site-packages/werkzeug/serving.py in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
1028 s = socket.socket(address_family, socket.SOCK_STREAM)
1029 s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
→ 1030 s.bind(server_address)
1031 if hasattr(s, “set_inheritable”):
1032 s.set_inheritable(True)

OSError: [Errno 98] Address already in use

Hm this seems like a different issue than the one that you described. I don’t use Dash in Jupyter notebooks but I believe the “Address already in use error” only comes up when I try to reuse the same port. Make sure to restart the kernel of the notebook between attempts at running the dash application or change the port to something else each time you run it:

if __name__ == "__main__":
    app.run_server(debug=True, port=8051)

You probably want to use an actual IDE (e.g. Pycharm) for developing a Dash app. They get pretty complicated so the extra features will come in useful, and you don’t get any of the advantages of the notebook environment.

I use Jupyter notebook, IPython, Python shell and Dash module don’t work.

It still don’t work, even with restarting kernel and adding port 8051 in code.

I would strongly recommend against using Jupyter for a dash tutorial - the Jupyter environment doesn’t work well with running a Flask application (it’s complicated to get into, and that conversation would just detract from the learning dash part of the tutorial). If you are set on using Jupyter for the tutorial, you could try using JupyterDash (I’ve previously used it in notebooks). More info on that here

What do you use for Dash module?

Thank you very much, finally it works.

How did you resolve this issue?

First, Iused codes from this web page Introducing JupyterDash. We’re excited to announce the release… | by plotly | Plotly | Medium.

Last week I installed gunicorn and now Dash Plotly module work without JupyterDash.

Thank you so much

Are you yousing colab or something else sir. because still it is not working for me

I don’t use colab.

I tried now and it works on my laptop (I have Windows on Windows).

  1. Create virtual environment.
    2.Activate vrtual environment
  2. Install necessary modules, dash, dash_bootstrap_components, pandas, …(python -m pip install (some module))
  3. Execute your Script from command prompt

From command prompt I can stop executing script with Ctrl+C . But I cannot do it from IDLE (I have to kill it).

Thank you for your prompt response. Looks like gunicorn only for Unix , not for windows. I will try with windows.

I hope that it will work, I was very happy last week to see it works on my laptop and windows after several months of looking for solution.

1 Like