Django will not upgrade. Gunicorn will not run virtualenv python interpreter.

July 11, 2017 159 views
Django Ubuntu

I decided to upgrade my Django site finally, making a jump from 1.6 to 1.11

Simply using the pip method didn't work because it throws an error about the old version of Django being owned by OS and no supplication to the sudo gods will change its mind about that.

Fine, I thought, I should be using virtualenv anyway. I'll just figure that out. So I create a virtualenv at /home/django/ahe/ahe and install django 1.11

I have a gunicorn daemon running via an upstart script so I also install gunicorn in the virtualenv. I alter the gunicorn.conf so that it calls this new gunicorn. I kill the old processes. New ones pop up immediately, but when I point my browser to my homepage the result is still running Django 1.6

I've tried to keep this simple, but I've actually spent hours trying different ways of solving this and I am at a loss. Any help is appreciated. Here's my gunicorn.conf:

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

# If the process quits unexpectadly trigger a respawn
respawn

setuid django
setgid django
chdir /home/django

script
    exec 2>>/tmp/upstartconfig.log
    set -x
    # Run gunicorn from the virtualenv
    cd /home/django/ahe/ahe
    source bin/activate

    exec /home/django/ahe/ahe/bin/gunicorn \
        --name=django_project \
        --pythonpath=django_project \
        --bind=127.0.0.1:9000 \
        --config /etc/gunicorn.d/gunicorn.py \
        django_project.wsgi:application
end script
1 comment
Be the first one to answer this question.