August 2016
Beginner to intermediate
717 pages
15h 24m
English
Since version 1.7, Django can be used with Python 2.7 and Python 3. In this recipe, we will take a look at the operations to make your code compatible with both the Python versions.
When creating a new Django project or upgrading an old existing project, consider following the rules given in this recipe.
Making your code compatible with both Python versions consists of the following steps:
from __future__ import unicode_literals and then use usual quotes without a u prefix for Unicode strings and a b prefix for bytestrings.django.utils.encoding.smart_bytes function. To ensure that a value ...Read now
Unlock full access