# Uwsgi fails to find python app

**URL:** https://community.plotly.com/t/uwsgi-fails-to-find-python-app/58333
**Category:** Dash Python
**Created:** [November 11, 2021, 6:27pm UTC](https://community.plotly.com/t/uwsgi-fails-to-find-python-app/58333 "2021-11-11T18:27:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![padraigH](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@padraigH](https://community.plotly.com/u/padraigH)
#### Post date: [November 11, 2021, 6:27pm UTC](https://community.plotly.com/t/uwsgi-fails-to-find-python-app/58333/1 "2021-11-11T18:27:04Z")

</div>

I’m going in circles… Mainly because I cannot find a complete, clear, tutorial on how to deploy python Dash using uwsgi/flask and Nginx.

Can someone please please please provide one?

I don’t want to see 3 different ways to try different solutions to bits and pieces of a complicated chain relating python/uflask and uwsgi. I ( and I strongly suspect many others) really want to see one decent recipe and strategy to learn from.

For project.py - show an explicit app/dash.Dash, server (Flask) and app.run\_server config  
For wsgi.py an explicit config that works  
for project.ini - a config that works  
A uwsgi command line that works

It’s beyond frustrating that no such recipe exists to learn from.

(My apologies in advance if I’m coming across overly energized ! )

---

<div class="post-metadata">

### Author: ![padraigH](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@padraigH](https://community.plotly.com/u/padraigH)
#### Post date: [November 11, 2021, 7:40pm UTC](https://community.plotly.com/t/uwsgi-fails-to-find-python-app/58333/2 "2021-11-11T19:40:18Z")

</div>

I made some progress. Here’s the solution that works for me.

I hope I can save someone else from days of frustration !

PH  
’

Note the app and server and flask elements in the helloproj.py program.  
Note the use of ‘application’ in the wsgi.py file  
Note the use of wsgi:application in the uwsgi command line…

Note this blog doesn’t seem to allow underscores so they are hidden when using variables like ‘main’ and ‘name’ in the above.

Uwsgi /Python/Flask Recipe

++++++++++++++++++ **helloproj.py** +++++++++++++++++++++++++++++++++++++

import dash  
from dash import dcc  
from dash import html  
from dash.dependencies import Input, Output  
from datetime import datetime

import flask

server = flask.Flask( **name** )

app = dash.Dash( **name** ,server=server)

…

if **name** == ‘ **main** ’:

```
    app.run_server(debug=True, host='0.0.0.0')

```

+++++++++++++++++++++++++END helloproj.py+++++++++++++++++++++++++++++++++++++++++

+++++++++++++++++++++++++++++++++ wsgy.py +++++++++++++++++++++++++++++++++++++

from helloproj import server as application

if **name** == “ **main** ”:

```
    application.run()

```

+++++++++++++++++++++++++++ END wsgy.py +++++++++++++++++++++++++++

++++++++++++++++++ RUN uwsgi from environment helloprojenv ++++++++++++++++++++++++++++++

(helloprojenv) uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi: application

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Now the application is visible from 127.0.0.1:5000

Note the use of ‘wsgi:application’ in the uwsgi command (not uwsgi:app).

---

<div class="post-metadata">

### Author: ![padraigH](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@padraigH](https://community.plotly.com/u/padraigH)
#### Post date: [November 11, 2021, 9:30pm UTC](https://community.plotly.com/t/uwsgi-fails-to-find-python-app/58333/4 "2021-11-11T21:30:43Z")

</div>

testing usage of underscores:

‘ **name** ’
