Django: how to upgrade from 1.1 to 1.2? - django

Does anyone know how to / can anyone link to simple instructions for how to upgrade from Django 1.1 to Django 1.2?
I can find masses of documentation on the differences between them, the changes you'll need to make to your project etc.
What I can't find is actually how to upgrade!
Thanks.

I usually create a symlink from my Python site-packages directory to the Django version I am using. When I change versions I merely change the symlink to point at the right version. Here is the documentation for creating a symlink. The docs mention the development version but you can do it for any version.

Django 1.2 is fully compatible with 1.1, so your projects could stay the same way.
To update django in your server:
If you already have a svn repository, just update it, Otherwise uninstall Django and then download it again from here http://www.djangoproject.com/download/ I have never had problems with trunk version, but that is your decision.

svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk
cd django-trunk
sudo python setup.py install

First, follow the instructions for removing old versions of Django
Then, you can follow these steps to pull the released branch of 1.2.x:
svn co http://code.djangoproject.com/svn/django/branches/releases/1.2.X/ django
cd django
sudo python setup.py install
I agree with uanefren, though. Using trunk has never posed any issues for me, and it probably has the best ongoing support and most current documentation.

Here's a good link using pip: how do you install django older version using easy_install?, which essentially comes down to:
pip install --upgrade django==1.2.5 (Which is the latest version of 1.2, AFAIK)
Also, before upgrading, make sure you read:
https://docs.djangoproject.com/en/1.2/releases/1.2/
and
https://docs.djangoproject.com/en/1.2/ref/contrib/csrf/#ref-csrf-upgrading-notes
As 1.2 implemented breaking changes for CSRF tokens. Also, make sure your save and delete methods include **kwargs, as the multiple database change adds a kwarg to the save (and possibly the delete) method(s).
If you run Activestate, you can use pypm install django==1.2.5 instead.

Imho most common problem of upgrade like this is CSRF protection changes you will meet in you Upgrading way.
Main thing here is to read https://docs.djangoproject.com/en/1.3/releases/ of your django version. 1.2 is in your case.
This update has some backwards incompatible changes with CSRF protection described almost fist in 1.2 release changes.
There also some articles like http://garmoncheg.blogspot.com/2011/07/django-upgrading-django-from-11-to-125.html on blogs. Here is a brief look at this problem.
Hope this will help someone with those issues.

Related

Is there are difference between working with Django vs Django on Anaconda

I am learning Django and I saw that you can install it regularly, according to the Django documentation. But I also saw that you can work with it in Anaconda. Is there a difference in developing? Or is it all just the same.
Thanks
Anaconda is a distribution on Python that comes with specific versions of a bunch of libraries so that everything is compatible and ready for data science.
So for Django, it will only give you a specific version of it. If you intend to use Anaconda as a framework to do data science, it might be worth it. If you just need Django, just install Django standalone.

Django installation dependency errors after rolling back to Python 3.7.6

I'm working my way through the tutorials in William S. Vincent's Django for Beginners. Everything worked fine until Chapter 4 (the Message Board app), when like a nOOb I ran into the known bug that causes Django's web server to crash when attempting to serve /admin/ using Python 3.7.* in pipenv. So, I upgraded Python to 3.8.2, and it still didn't work. So I foolishly deleted 3.8.2 and rolled back to 3.7.6, and now I can't install Django at all with pipenv due to a variety of pipenv.exceptions.ResolutionFailure statements.
I've reinstalled Python 3.7.6 AND 3.8.2, pip3, pipenv and Django (through Anaconda as well as outside of it), but I'm still getting the same litany of errors that won't let Django be installed in my virtual environment. Using pipenv lock --pre --clear doesn't fix it.
The telling line is "ERROR: No matching distribution found for django-3-0"
Does anyone have any idea how to resolve this or what packages I need to uninstall/reinstall?
Thanks much! :)
Manually delete the whole pipenv cache directory,
~/.cache/pipenv - (Linux)
%LOCALAPPDATA%\pipenv\pipenv\Cache - (Windows)
Also delete the previous virtualenvs which were created within the .virtualenvs folder. (or the entire folder)
Default location: C:\Users\{username}\.virtualenvs
Also delete Pipfile.lock file and then recreate your virtual environment:
pipenv shell
Well, good news! On a hunch, and to rule-out any weirdness, I tried recreating a clean Django install by using virtualenv, since pipenv is giving me problems. It worked! I must have borked something with pipenv when I removed/re-added/re-removed Python 8.x. Thanks for your inspiration for this workaround, #Magicoder!

Upgrade Ionic 2.0.0-beta.32 to latest 2.0.1 or final release

I am trying to upgrade my Ionic environment to the latest version.
I have an existing app I built on Ionic 2.0.0-beta.32. I want to upgrade it to the latest version 2.0.1 (or the final release).
My questions are :
1) How can I upgrade my environment ?
2) Is there any changes I have to do in my code ? (if yes please can you tell me exactly how to proceed it... ?)
answering question 1:
try these in the root of your project
sudo npm install -g ionic
ionic lib update
question number 2 is hard to answer. generally you should be good. You should try running your code and do some regression testing and then ask specific questions if you face any problems.
Ionic provides upgrade instructions in their changelog. Usually it is enough to upgrade your package version, but sometimes when there are breaking changes that you need to manually address they will be listed on that page.

django virtualenv vs repository packages

I'm new to django and I'm trying to find out which way to build project is better:
Build own virtualenv for each (including core django packages, which available via systemm repository) project
or
use packages from debian repository (if available, otherwise put it in virtualenv).
As I understand, in case any security update the repository version will receive patch asap, however virtualenv version I'll need patch myself.
However in case of movement to another server virtual will cause less issues, then repository version.
What is the best practices?
As far as I know virtualenv is used by almost every django developer.
It is also good practice to have versions in your requirements.txt so that if some of the packages change you'll have your project working in production.
I think virtualenv is de facto the best practice for development with Python (not just with Django)

Using sphinx-api-doc when both sphinx and django are in multiple virtualenv

I have multiple django projects running different django versions in their own virtualenv. I want to use sphinx-api-doc command to generate api docs for the django projects. However i dont want to install sphinx directly in the system and would like to install it in a separate virtualenv.
Since only one virtualenv can be activated at a time, i am not able to use sphinx-api-doc. Is there a way to use sphinx-api-doc with sphinx and django in independent virtualenv or is installing sphinx directly in the system the only way to go?
The api documentation for your code can only be generated with proper access to your code, so the anser will be "no, you'll need to have them both in the same virtualenv".
Some extra thoughts:
If your code virtualenv isn't isolated from the system's python packages, you could install sphinx globally, but you probably don't and shouldn't want that.
I'd just add sphinx to your code's virtualenv. I don't think you'll have to worry about extra overhead of a few extra kilobytes.