plotly dash: change default port

Vlad picture Vlad · Aug 22, 2017 · Viewed 8.8k times · Source

Following plotly dash getting started guide but when trying to run python app.py get message:

OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

Seems the default address: http://127.0.0.1:8050/ is already being used. How can the default port be changed so I can get this to work?

Answer

Oleh Rybalchenko picture Oleh Rybalchenko · Aug 23, 2017

As we can see in Dash.run_server method definition, port can be passed as parameter:

def run_server(self,
               port=8050,
               debug=True,
               threaded=True,
               **flask_run_options):
    self.server.run(port=port, debug=debug, **flask_run_options)

So, if you need to use another port:

if __name__ == '__main__':
    app.run_server(debug=True, port=8051) # or whatever you choose