Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I update my version of Django?

Tags:

python

django

I currently have it installed and it's running a website.

http://www.djangoproject.com/download/ This is the new version. How do I upgrade it? (How do I install the new version over my current one?)

like image 735
TIMEX Avatar asked Feb 04 '10 07:02

TIMEX


People also ask

How do I check the version of Django?

The very first method to check the version of Django is simply to write python -m django –version in your terminal. This code will return the version of your Django in the format 3.2. 9. If python doesn't work replace it with python3.

Which version of Django should I use?

What Python version should I use with Django? ¶ Since newer versions of Python are often faster, have more features, and are better supported, the latest version of Python 3 is recommended.

How do I install a specific version of Django?

If you want to install a specific Django version, then you use the exact same command but you add something at the end, which is you define the version that you want to use, so a double equal sign ( == ) and then a version number is going to make pip install that specific version of Django.


2 Answers

read about this in :

http://docs.djangoproject.com/en/dev/topics/install/

For installing Django to be able to update to the latest code in trunk:

If you'd like to be able to update your Django code occasionally with the latest bug fixes and improvements, follow these instructions:

1.Make sure that you have Subversion installed, and that you can run its commands from a shell. (Enter svn help at a shell prompt to test this.)

2.Check out Django's main development branch (the 'trunk') like so:

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk 3.Next, make sure that the Python interpreter can load Django's code. There are various ways of accomplishing this. One of the most convenient, on Linux, Mac OSX or other Unix-like systems, is to use a symbolic link:

ln -s pwd/django-trunk/django SITE-PACKAGES-DIR/django (In the above line, change SITE-PACKAGES-DIR to match the location of your system's site-packages directory, as explained in the "Where are my site-packages stored?" section above.)

Alternatively, you can define your PYTHONPATH environment variable so that it includes the django-trunk directory. This is perhaps the most convenient solution on Windows systems, which don't support symbolic links. (Environment variables can be defined on Windows systems from the Control Panel.)

What about Apache and mod_python?

If you take the approach of setting PYTHONPATH, you'll need to remember to do the same thing in your Apache configuration once you deploy your production site. Do this by setting PythonPath in your Apache configuration file.

More information about deployment is available, of course, in our How to use Django with mod_python documentation.

4.On Unix-like systems, create a symbolic link to the file django-trunk/django/bin/django-admin.py in a directory on your system path, such as /usr/local/bin. For example:

ln -s pwd/django-trunk/django/bin/django-admin.py /usr/local/bin This simply lets you type django-admin.py from within any directory, rather than having to qualify the command with the full path to the file.

On Windows systems, the same result can be achieved by copying the file django-trunk/django/bin/django-admin.py to somewhere on your system path, for example C:\Python24\Scripts.

You don't have to run python setup.py install, because you've already carried out the equivalent actions in steps 3 and 4.

When you want to update your copy of the Django source code, just run the command svn update from within the django-trunk directory. When you do this, Subversion will automatically download any changes

For updating Django from stable release to another stable release:

If you are upgrading your installation of Django from a previous version, you will need to uninstall the old Django version before installing the new version.

If you installed Django using setup.py install, uninstalling is as simple as deleting the django directory from your Python site-packages.

If you installed Django from a Python egg, remove the Django .egg file, and remove the reference to the egg in the file named easy-install.pth. This file should also be located in your site-packages directory.

like image 148
Haim Evgi Avatar answered Oct 11 '22 22:10

Haim Evgi


First of all, don't. Install/upgrade it on your staging server first and test your app to make sure that it still works. Only after complete testing should you cut over to the new version on your production website.

like image 40
Ignacio Vazquez-Abrams Avatar answered Oct 12 '22 00:10

Ignacio Vazquez-Abrams