Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Python 3 app that I install into a virtual environment (letting pip automatically fetch dependencies). I'm trying to get it to run under nginx and uwsgi on my raspberry pi.

When I have nginx and uwsgi running, visiting http://localhost/icecrate results in "uWSGI Error Python application not found". I assume this means nginx is properly connecting to uwsgi, and it is uwsgi that can't find the application.

However, If I run the app with uwsgi --http /etc/uwsgi/apps-enabled/icecrate.ini then http://localhost:8080 gives me the application, which suggests the uwsgi config is at least adequate.

I've been searching Google and the docs for a few hours for a solution. I don't know what I'm doing wrong here.


server {
  listen      80;
  server_name raspberrypi;

  access_log  /home/icecrate/logs/access.log;
  error_log   /home/icecrate/logs/error.log;

  location /icecrate {
    uwsgi_pass unix:///tmp/icecrate.sock;
    include    uwsgi_params;


vhost = true
plugins = python3
socket = /tmp/icecrate.sock
master = true
enable-threads = false
processes = 1

# this just imports the app callable and renames it to application
wsgi-file = /home/icecrate/

# I get the same results using this method
#module = icecrate.web
#callable = app

virtualenv = /home/icecrate/env
touch-reload = /home/icecrate/reload

Application code is at GitHub.

share|improve this question
up vote 1 down vote accepted

I ended up nuking the attempt and all the configs and starting over, but I think I got this figured out. I'm fairly certain it was a permissions issue.

By default nginx.conf specified www-data as the user it runs as, and the previous attempt made no effort at dealing with that. All files were owned by myself. Rather than change the default user, I made a home folder for www-data, which now holds the icecrate virtualenv. When setting up the app, I used sudo -s -u www-data to do all the file creation, so all the files have the proper owner and permissions.

The Nginx config is essentially the same, except the virtualenv folder now plays home to the socket and logs:

server {
  listen 80;
  server_name = raspberrypi;

  access_log /home/www-data/icecrate/logs/access.log;
  error_log /home/www-data/icecrate/logs/error.log;

  location /icecrate {
    uwsgi_pass unix:///home/www-data/icecrate/icecrate.sock;
    include uwsgi_params;

I skipped some things that looked not important to the problem while rebuilding the uwsgi app ini, but it too is essentially the same:

plugins = python3
socket  = /home/www-data/icecrate/icecrate.sock
module  = icecrate.web:app
virtualenv = /home/www-data/icecrate
touch-reload = /home/www-data/icecrate/reload

# like ngnix, uwsgi should be www-data.
uid = www-data
gid = www-data

# don't think this works, though
logto = /home/www-data/icecrate/logs/uwsgi.log

After putting the config files in sites-enabled and apps-enabled respectively, I started nginx and uwsgi and pointed my browser at http://localhost/icecrate and got a 404 error. I don't think I've ever been so happy in my life to see a 404.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.