oracledjango

Upgrade Django

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Follow the steps below, depending on your installation type.

IMPORTANT: Before upgrading Django, make sure that your Django applications are compatible with the new version.

Approach A: Bitnami installations using system packages

To upgrade Django, execute the following command:

$ sudo pip install --upgrade Django

If you want a specific version of Django (not the latest one), add the version number as shown below:

$ sudo pip install --upgrade Django==3.0.7

Approach B: Self-contained Bitnami installations

  • Execute this command from the uncompressed directory:

    $ sudo pip install --upgrade Django --install-option="--prefix=/opt/bitnami/apps/django"
    

    If you want a specific version of Django (not the latest one), add the version number as shown below:

    $ sudo pip install --upgrade Django==3.0.7 --install-option="--prefix=/opt/bitnami/apps/django"
    
  • Edit the django-admin.py script (usually in /opt/bitnami/apps/django/bin) and change the first line to use python3 instead of .python2.7.bin:

    #!/opt/bitnami/python/bin/python3
    
Last modification July 1, 2020