WebFaction
Community site: login faq

I currently have django 1.2.3 how do I upgrade it?

(I found my version by running python manage.py shell

then enter import django print django.VERSION

The Django site says tar xzvf Django-1.3.1.tar.gz cd Django-1.3.1 sudo python setup.py install

but that doesn't seem right.

asked 24 Sep '11, 19:38

sharecube
111
accept rate: 0%


We have documentation here http://docs.webfaction.com/software/django/config.html#upgrading-your-django-libraries that explains the upgrade process. If you have any troubles, you can open a support ticket here https://help.webfaction.com/

permanent link

answered 24 Sep '11, 20:07

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

Here's a script version to upgrade to 1.3.4 (which appears to be the latest 1.3.x security update as of Nov 2012) ... no guarantees, use at your own risk, etc. Save the following as a script (e.g. upgrade_django.sh), chmod +x upgrade_django.sh then run with ./upgrade_django.sh ... edit MYAPPNAME if your app is called something other than "django" ... you can check the names by 'ls' in the webapps folder.

#!/bin/sh

# adapted from http://docs.webfaction.com/software/django/config.html#upgrading-your-django-libraries

# TBD: show how to find the Python Version ... I checked https://my.webfaction.com/applications/ ...
# CAVEAT: upgrading like this will NOT update which version is shown in the above control panel
# to find the actual Django version (after the 'cd' command): python2.7 YourProjectName/manage.py --version

MYAPPNAME="django"
NEWVERSION="1.3.4"
PYTHONVERSION="2.7"

echo ''
echo 'upgrade the Django app named $MYAPPNAME to Django version $NEWVERSION'
echo '(the following status messages are NOT the full commands)'

# Go to your Django application directory.
echo 'cd'
cd $HOME/webapps/$MYAPPNAME

# Download the Django source package.
echo 'wget'
wget https://www.djangoproject.com/download/$NEWVERSION/tarball/

# Decompress the archive.
echo 'decompress'
tar -zxvf Django-$NEWVERSION.tar.gz

# Rename your old Django libraries to move them out of the way.
echo 'move'
mv lib/python$PYTHONVERSION/django lib/python$PYTHONVERSION/django.old

# Copy the new libraries into your Python library directory.
echo 'copy lib'
cp -R Django-$NEWVERSION/django lib/python$PYTHONVERSION

# Copy the new management scripts into $HOME/webapps/$MYAPPNAME/bin.
echo 'copy bin'
cp Django-$NEWVERSION/django/bin/* bin

# Make any necessary adjustments to your project code as directed by the release notes for the version of Django to which you are upgrading.

# Restart the Django application.
echo 'restart apache'
apache2/bin/restart

# Delete the Django source archive and directory.
echo 'remove the downloaded files'
rm -rf Django-$NEWVERSION*

# Delete your old Django libraries.
echo 'TBD after testing: MANUALLY remove the previous Django version'
echo 'i.e. run the following: rm -rf lib/python$PYTHONVERSION/django.old'

echo 'done'
echo ''

# make sure there's a newline after the last command
permanent link

answered 14 Nov '12, 12:14

Scott Lawton
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×40

question asked: 24 Sep '11, 19:38

question was seen: 5,987 times

last updated: 14 Nov '12, 12:14

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM