Uwsgi fails to find python app

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 ! )

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).

testing usage of underscores:

name