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
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!
This comment has been deleted
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 django_project.settings.py 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 settings.py.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.