Uwsgi wont load app when run as service
<p>I have setup a basic flask application in Centos 6, everything is contained in one file(app.py). I can run the file with uwsgi from the folder directory with the command <code>uwsgi --ini myuwsgi.ini</code> and everything works great. The contents of the ini file are: </p>

<pre><code>[uwsgi]
http-socket    = :9090
plugin    = python
wsgi-file = /project/app.py
process   = 3
callable = app
</code></pre>

<p>However I want to set this up so everytime the server is shutdown or whatever that it will come up on its own. When I try to run the command <code>service uwsgi start</code> the logs show that no app was found. The ini file that the service uses is <code>/etc/uwsgi.ini</code> and I replaced it with my ini file.</p>

<p>The dump of the log is as follows if it helps: </p>

<pre><code>*** Starting uWSGI 2.0.13.1 (64bit) on [Fri Sep  2 07:49:37 2016] ***
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-17) on 02 August 2016 21:07:31
os: Linux-2.6.32-042stab113.21 #1 SMP Wed Mar 23 11:05:25 MSK 2016
nodename: uwsgiHost
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /
detected binary path: /usr/sbin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 14605
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address :9090 fd 3
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 1315, cores: 1)
-- unavailable modifier requested: 0 --
</code></pre>

<p>If anyone could tell me why it cant find the app when i specified the location and callable in the ini? </p>

<p>Try the following config and let me know if it works for you:</p>

<pre><code>[uwsgi]
callable = app
chdir = /path/to/your/project/
http-socket = :9090
plugins = python
processes = 4
virtualenv = /path/to/your/project/venv
wsgi-file = /path/to/your/project/app.py
</code></pre>

<p>You may also need to add <strong>uid</strong> and <strong>gid</strong> params.</p>

<p>Make sure that you have installed the package <strong>uwsgi-plugin-python</strong>:</p>

<pre><code>apt-get install uwsgi-plugin-python
</code></pre>

python service flask centos uwsgi