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'm following this to install and configure Nginx, uWSGI, and Django on Gentoo. Everything looks good until the last step: Nginx returns the 502 Bad Gateway error and the following appears in the uWSGI log:

*** Starting uWSGI 1.2.4 (32bit) on [Mon Sep 10 23:41:29 2012] ***
compiled with version: 4.5.3 on 02 September 2012 22:00:55
detected number of CPU cores: 2
current working directory: /var/www/localhost/htdocs/mysite
writing pidfile to /var/run/uwsgi/
detected binary path: /usr/bin/uwsgi
your memory page size is 4096 bytes
building mime-types dictionary from file /etc/mime.types...1017 entry found
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address fd 3
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14105)
spawned uWSGI worker 1 (pid: 14108, cores: 1)
-- unavailable modifier requested: 0 --
-- unavailable modifier requested: 0 --

Google point me to this, but for Ubuntu. What is the equipvalent of the uwsgi-plugin-python package on the Gentoo?


    location /mysite {
        root        /var/www/localhost/htdocs/mysite/polls;
        include     uwsgi_params;   


share|improve this question
up vote 2 down vote accepted

First, make sure that the uwsgi is installed with python USE flag enabled:

[I] www-servers/uwsgi
     Available versions:  ~ ~1.2.3-r3 ~1.2.3-r4 (~)1.2.4 {apache2 +caps +carbon cgi debug elibc_FreeBSD erlang gevent graylog2 json ldap lua +nagios +pcre perl php php_targets_php5-3 php_targets_php5-4 +python rrdtool rsyslog ruby ruby_targets_ree18 ruby_targets_ruby18 ruby_targets_ruby19 spooler sqlite syslog +xml yaml zeromq}
     Installed versions:  1.2.4(10:01:48 PM 09/02/2012)(apache2 caps carbon cgi ldap nagios pcre php_targets_php5-3 python ruby_targets_ruby18 ruby_targets_ruby19 xml -debug -elibc_FreeBSD -erlang -gevent -graylog2 -json -lua -perl -php -php_targets_php5-4 -rrdtool -rsyslog -ruby -ruby_targets_ree18 -spooler -sqlite -syslog -yaml -zeromq)
     Description:         uWSGI server for Python web applications

Second, edit the init script and change the UWSGI_EXEC variable to /usr/bin/uwsgi_python27 instead of /usr/bin/uwsgi:



Then restart the uwsgi and try again.

share|improve this answer

For application only. Just set the desired python version in plugins.

Example /etc/uwsgi.d/mysite.ini:

plugins = python27
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.