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

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

setuid django
setgid django
chdir /home/django

    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= \
        --config /etc/gunicorn.d/ \
end script
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I previously deleted my answer (I briefly forgot about the edit button).

I’ve created several droplets in the past and upgrading django has always been a breeze however not sure what changed recently but it kept on defaulting to the django 1.8.7. It took me a while to figure it out but her was my solution.

Go to your root directory and run pip uninstall django

After that run django-admin --version. If this returns a version number like 1.8.7 or 1.1.1 etc, then run pip uninstall django again. Repeat this until you’re sure there is no version of django on your server.

After you’ve verified that your server doesn’t have django. Run pip install django. This will install the latest version of django on your server however you try to visit your server now you’ll most likely get an error saying it can’t find “django”.

To fix this, go to your “django_project” folder. I’m sure you have a development version of this but just in case backup all the files on your production server and then delete this folder.

Head over to your root directory and go to your directory to where django is stored in your home folder by running cd /home/django

Run django-admin startproject django_project

You should have a django_project folder in our django folder now. Go into and in ALLOWED_HOSTS add the IP address/domain of your server.

Run ``sudo service gunicorn restart ```

If you followed the steps above correctly then everything should be working. You’ll also have to reconfigure your static files again in your

This comment has been deleted

I am having the same issue. Spending way to much time on this