How to downgrade Django from dev to 1.1

I am launching a development version of Django, and it looks like the filebrowser application is incompatible with trunk due to changes made to CSRF. How do I switch to the official release (1.1)?

I am working on a shared host and the fact that I am running Django now is as follows:

~/local/lib/python2.6/site-packages/ contains /django/ as well as several other folders (one for each application).

~/local/lib/python2.6/site-packages/ is in the python path.

Inside /site-packages/ there is also a symbolic link to /projectname/ , which contains the project files (manage.py, settings.py, etc.).

I use FastCGI, so in /public_html/ I have dispatch.fcgi , which is used to call django.core.servers.fastcgi.runfastcgi . The .htaccess file .htaccess used to redirect all requests to dispatch.fcgi so that Django can handle them.

I tried removing (moving from the python path) /django/ and then downloading the version of Django and putting it where the previous /django/ folder was. This caused the following error:

There is no module named CSRF.

I downloaded middleware/csrf.py from /trunk/ , which cleared the first error, but then produced other errors.

How do I go down to 1.1? Starting from scratch is not out of the question, but I would obviously prefer to avoid this if possible.

+6
django downgrade
source share
3 answers

I managed to successfully lower the rating, and this is actually a very simple process. Hope this helps people who overlook what I did.

The startproject django-admin.py command in 1.1.1 creates a slightly different settings.py file than the current release.

startproject with the current version of dev has an additional middleware class - csrf. The startproject command in 1.1.1 creates the same settings.py parameters, but with the removal of the third class. By commenting or deleting this line, Django works correctly.

 MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', #additional middleware class 'django.contrib.auth.middleware.AuthenticationMiddleware', ) 
+1
source share

Look in the /site-packages/ directory for the Django-1.other_stuff.egg-info files and delete everything you find, then try again (with the code for 1.1 still in the site-packages/django/ directory. If it is doesn't work, just run the Django Installer from the latest version of tarball (installing python setup.py) and you should be good.

Alternatively, if you installed pip , you can simply do pip install -U Django==1.1.1 in the terminal.

Note the D capital in Django in these egg info files and the pip command.

+8
source share

you can just install the django version you want in your user space, for example, in / home / me / lib /

then if you use mod_wsgi in mysite.wsgi run the following line:

 sys.path.insert(0,'/home/me/lib/Django-1.1') 

this will ensure that django is downloaded from your installation, and not across the server.

you will also need to adjust the shell environment path variable in order to run django-admin.py or just start directly

 python /home/me/lib/Django-1.1/django/bin/django-admin.py ... 
+1
source share

All Articles