0

At first: When i started nginx i see errors in log:

unix:/root/project/flask_paramiko.sock failed (13: Permission denied) while connecting to upstream

uwsgi.ini:

[uwsgi]
#chdir  = /root/project
module = wsgi:app

master = true
processes = 5

socket = flask_paramiko.sock
chmod-socket = 666
vacuum = true

die-on-term = true

wsgi.py

from flask_paramiko import app

if __name__ == "__main__":
    app.run()

uwsgi --socket /root/project/flask_paramiko.sock --wsgi-file wsgi.py:

unable to find "application" callable in file wsgi.py
unable to load app 0 (mountpoint='') (callable not found or import error)

/usr/bin/uwsgi --ini /root/project/uwsgi.ini works fine without any errors.

I don't mind where is an error.

  • `/root/` does not sound like a path you would typically want accessible to anyone other than an internal system user called `root`. Also, how exactly are you starting uwsgi (a systemD unit? a sysV init script? - the chdir parameter might actually be useful if your init daemon does not pass the directory) – anx Jun 11 '21 at 14:02
  • Moved to different folder. Starting uwsgi via systemd unit. – Explorethetruth Jun 11 '21 at 14:19

1 Answers1

0

You are using two different options, one specifies just the file the other the module

--module=wsgi:app works fine without any errors

--wsgi-file=wsgi.py unable to find "application" callable

(there is not much difference between --option=value on cmdline and option value in the ini)

The literal application is just the name uwsgi defaults to looking for if you only pass the file name. If you application is called app instead, well then say so on the command line or in the config.

anx
  • 8,963
  • 5
  • 24
  • 48
  • Thanks. Solved this problem. Can i ask additional question? My flask app serving a many "routes", do i need to create all of them in nginx.conf? or nginx have an easy way to serve it? – Explorethetruth Jun 11 '21 at 14:23
  • First ask yourself: *Do I need Nginx to treat different routes differently?* In any case, thoroughly read the documentation of your framework (sounds like *flask*) on what other considerations are important during deployment, there is more to this than just routes. – anx Jun 11 '21 at 14:46