ubuntu + nginx + uwsgi + django No Python application found

30,764

Solution 1

It 's wsgi-file not wsgi_file, command line options and file options are always the same

Solution 2

aptitude install uwsgi-plugin-python

and then restart uwsgi you will see the correct page.

Solution 3

Just to add to the overall confusion concerning uwsgi & django here is an ini file that works for me.

It works with http & http-socket but NOT socket.

it is designed to run with multiple settings files in a directory settings a'la two scoops of django multiple deployment files ( which is why I was testing)

so ---/velocity is the 'home' project directory where manage.py lives. /velocity/velocity/settings/dev_settings_chris_l.py is the actual settings file

THis all needs to be done because you need to be able to stear the correct settings files from outside of the django code and thus can't have lines setting DJANGO_SETTINGS_MODULE inside wsgi.py or indeed manage.py (use django-admin)

There is a lot of discussion about this sort of thing with various error messages reported. Hopefully althou' not entirely relevant to the question it might help someone.

Django 1.8

[uwsgi]
http-socket = 127.0.0.1:8004 
buffer-size = 32768
processes = 4
threads = 2
pythonpath = .. 
env = DJANGO_SETTINGS_MODULE=velocity.settings.dev_chris_l
module=velocity.wsgi:application
home = /home/chris/.virtualenvs/velocity 
plugin = python,http 
show-config 
stats =  127.0.0.1:9191
chdir = /home/chris/development/webfuels/velocity
Share:
30,764

Related videos on Youtube

OpIvy
Author by

OpIvy

Updated on September 18, 2022

Comments

  • OpIvy
    OpIvy over 1 year

    I am trying to setup my server with a nginx to uwsgi to django stack, but I am having problems with the uwsgi part.

    When I run uwsgi and pass in all the parameters on the command line, it works properly. My uwsgi call looks like this:

    uwsgi --socket /tmp/uwsgi.sock --chdir ~/web/test.com --wsgi-file ~/web/test.com/store/wsgi.py --virtualenv ~/web/test.com/testenv --chmod-socket=666 --enable-threads
    

    I then copied those parameters into an ini file that looks like this:

    # django.ini file
    [uwsgi]
    master          = true 
    socket          = /tmp/uwsgi.sock
    chmod-socket    = 666
    chdir           = /home/ubuntu/web/test.com
    wsgi_file       = /home/ubuntu/web/test.com/store/wsgi.py
    virtualenv      = /home/ubuntu/web/test.com/causumptionenv
    vacuum          = true
    enable-threads  = true
    

    However, when I run uwsgi with the django.ini file, I get this output.

    [uWSGI] getting INI configuration from django.ini
    *** Starting uWSGI 1.9.11 (64bit) on [Fri May 31 14:52:44 2013] ***
    compiled with version: 4.6.3 on 30 May 2013 15:40:11
    os: Linux-3.2.0-40-virtual #64-Ubuntu SMP Mon Mar 25 21:42:18 UTC 2013
    nodename: ip-10-245-64-211
    machine: x86_64
    clock source: unix
    detected number of CPU cores: 1
    current working directory: /home/ubuntu/web/test.com
    detected binary path: /usr/local/bin/uwsgi
    your processes number limit is 4594
    your memory page size is 4096 bytes
    detected max file descriptor number: 1024
    lock engine: pthread robust mutexes
    uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
    Python version: 2.7.3 (default, Aug  1 2012, 05:25:23)  [GCC 4.6.3]
    Set PythonHome to /home/ubuntu/web/test.com/testenv
    Python main interpreter initialized at 0xcb4dd0
    python threads support enabled
    your server socket listen backlog is limited to 100 connections
    your mercy for graceful operations on workers is 60 seconds
    mapped 145440 bytes (142 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 master process (pid: 15976)
    spawned uWSGI worker 1 (pid: 15977, cores: 1)
    --- no python application found, check your startup logs for errors ---
    

    Most notable are the lines "no app loaded. going in full dynamic mode and no python application found, check your startup logs for errors

    So my question is, whats the difference between passing the parameters on the command line and passing them through an ini file?

    • OpIvy
      OpIvy almost 11 years
      I ended up solving it by changing the 'wsgi_file' line to be 'module = store.wsgi:application'. Whats really strange is that the module parameter would not work when passing it on the command line.
  • OpIvy
    OpIvy almost 11 years
    Well thats embarrassing. I guess this is the one time that copy/paste would have actually saved me.
  • HBruijn
    HBruijn over 8 years
    Please don't "add to the overall confusion" :-) . Answers are always welcome though :p
  • Mario
    Mario about 4 years
    you mean __init__.py - and yes this is a possible reason. Deleted is one possibility, forgotten to add the file to a module folder is the other (my case). Saved me a lot of time. Thank you.
  • Ibrahim Tayseer
    Ibrahim Tayseer about 4 years
    yes and that what I typed the problem is if you added double underscores before and after any word it will be BOLD like this bold and I forgot to add the code mark __bold__
  • Ibrahim Tayseer
    Ibrahim Tayseer about 4 years
    Please vote up as my answer may help anyone who is missing or deleted these files by mistake. @Mario
  • Mario
    Mario about 4 years
    I already upvoted it.
  • SirSaleh
    SirSaleh about 4 years
    worked for me, thanks.