(env) ec2-user:/app/myflask $ uwsgi --http :9090 --wsgi-file run.py
*** Starting uWSGI 2.0.18 (64bit) on [Fri Jun 21 10:03:11 2019] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-28) on 20 June 2019 03:21:27
os: Linux-4.14.121-85.96.amzn1.x86_64 #1 SMP Wed May 22 00:45:50 UTC 2019
nodename: ip-172-31-7-89
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /app/myflask
detected binary path: /app/myflask/env/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7892
your memory page size is 4096 bytes
detected max file descriptor number: 4096
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :9090 fd 4
spawned uWSGI http 1 (pid: 5387)
uwsgi socket 0 bound to TCP address 127.0.0.1:39541 (port auto-assigned) fd 3
Python version: 3.6.8 (default, May 24 2019, 18:27:52) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x2710580
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
unable to find "application" callable in file run.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 5386, cores: 1)
ec2-user:~/environment $ curl localhost:9090 -v
* Rebuilt URL to: localhost:9090/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9090 (#0)
> GET / HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 500 Internal Server Error
< Connection: close
< Content-Type: text/plain
<
* Closing connection 0
Internal Server Error
unable to find "application" callable in file run.py
unable to load app 0 (mountpoint='') (callable not found or import error)
# Before
app = Flask(__name__)
# After
application = Flask(__name__)
ec2-user:~/environment $ curl localhost:9090 -v
* Rebuilt URL to: localhost:9090/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9090 (#0)
> GET / HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=utf-8
< Content-Length: 11
<
* Connection #0 to host localhost left intact
Hello World
https://serverfault.com/questions/412849/uwsgi-cannot-find-application-using-flask-and-virtualenv