I’m working my way through installing my simple django app on a new Ubuntu machine using the components mentioned above.
So far, here’s what I’ve done:
- apt-get install nginx-full
- apt-get install uwsgi uwsgi-plugin-python
- installed django from svn described in the docs
The nginx configuration can be found in /etc/nginx/sites-available/default. Of course, it’s best to make a copy of that file and edit it for the site/app I’m working on. Here’s what I put in it:
server {
listen 80;
server_name sss.grat.in;
access_log /var/log/nginx/sss.grat.in-access.log;
location /media {
alias /home/sss/app/media/;
}
location /static {
alias /home/sss/app/static/;
}
location / {
uwsgi_pass unix:///var/run/sss.grat.in.sock;
include uwsgi_params;
}
}
Now for the uWSGI configuration file. I created the file /etc/uwsgi/apps-available/sss.ini and added the following lines:
[uwsgi]
chdir = /home/sss/app
pythonpath = /home/sss
env = DJANGO_SETTINGS_MODULE=app.settings
# load django
module = django.core.handlers.wsgi:WSGIHandler()
it’s really just that. What took me so long was to figure out that in Debian/Ubuntu you have to install uwsgi-plugin-python, otherwise you’ll keep on getting weird error messages. Also, the default ini file has most of the settings (in /etc/default/uwsgi) so you should either read or edit that to make sure you’re getting all the right values.
1 Comment
Thank you for sharing this!
I was having a hard time trying to figure out why uwsgi was refusing to start until I found your blog post. As you mentioned, what was missing was the uwsgi-plugin-python package.