No python application found, check your startup logs for errors


This errors occured in setup Django + UWSGI in Ubuntu 14.04. The reason because the uwsgi from aptitude is broken.

1
2
3
4
Sat Oct 25 12:38:28 2014 – — no python application found, check your startup logs for errors —
[pid: 5556|app: -1|req: -1/1] 36.78.164.116 () {42 vars in 681 bytes} [Sat Oct 25 12:38:28 2014] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)
Sat Oct 25 12:38:29 2014 – — no python application found, check your startup logs for errors —
[pid: 5551|app: -1|req: -1/2] 36.78.164.116 () {42 vars in 681 bytes} [Sat Oct 25 12:38:29 2014] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 1 headers in 57 bytes (0 switches on core 0)

Here is the solution

1
2
3
4
sudo pip install uwsgi
cd /usr/bin
sudo mv uwsgi uwsgi-old
sudo ln -s /usr/local/bin/uwsgi uwsgi

Make sure you’re using right .ini wsgi :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
[uwsgi]
# enable master process manager
master = true

# spawn 2 uWSGI worker processes
workers = 2

# bind to UNIX socket at /run/uwsgi/<confnamespace>/<confname>/socket
socket = /tmp/dapurhemat.sock

# set mode of created UNIX socket
chmod-socket = 666

# place timestamps into log
log-date = true

# user identifier of uWSGI processes
uid = root

# group identifier of uWSGI processes
gid = root

; define variables to use in this script
project = dapurhemat

; number of worker processes
processes = 8

; plugins=python
; project-level logging to the logs/ folder

; django >= 1.4 project
chdir = /var/yodi/dapurhemat
wsgi-file=/var/yodi/dapurhemat/dapurhemat/wsgi.py

virtualenv=/root/.virtualenvs/dapurhemat

; run master process as root
enable-threads = true

vacuum = true
env = DJANGO_SETTINGS_MODULE=kargo.settings
pidfile2 = /tmp/dapurhemat.pid

You can test your app first with “python manage.py runserveR” before integrate with uwsgi

We also can check by manually running the “.ini” configuration:

1
uwsgi –ini yourfile.ini

If you got error like below:

1
2016/05/29 13:07:32 [error] 5589#0: *4 upstream prematurely closed connection while reading response header from upstream, client: 202.62.17.132, server: dapurhemat.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/tmp/dapurhemat.sock:", host: "dapurhemat.com"

Then, please install :

1
apt-get install uwsgi uwsgi-plugin-python

One response to “No python application found, check your startup logs for errors”

  1. Wow.. You know how techies think, I am new to Python and I was struggling with this issue for last 2 weeks, you saved me. Thank you very much.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.