Activating the virtual environment

In most cases, a Django project will be deployed within a virtual environment. Once you locate the virtual environment for the project, you can activate it by jumping to that directory and running the activated script for your OS.

For Linux, the command is as follows:

    $ source venv_path/bin/activate

Once the virtual environment is active, start a Python shell and query the Django Version, as shown:

    $ python
    >>> import django
    >>> print(django.get_version())
    1.5.9 

The Django Version used in this case is Version 1.5.9.

Alternatively, you can run the manage.py script in the project to get a similar output:

    $ python manage.py --version
    1.5.9

However, this option will not be available if the legacy project ...

Get Django Design Patterns and Best Practices - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.