python / 默认 · 1月 16, 2023 0

Django: How to check the Django version you’re using right now

内容纲要

You might be wondering () what is the version of Django you are using right now.

Method 1

python -m django --version

Method 2

django-admin --version

Method 3

The third method is known to almost all of us, but we might not have paid much attention () to it.

python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
February 22, 2022 - 20:32:37
Django version 4.0.2, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
E:\codespeedy\codespeedy_final\myproject\myapiapp\views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks...

Method 3

You can also check the pip version using pip.

pip freeze

The output somewhat () looks .

Django==3.2.9
djangorestframework==3.13.1

Method 4

django.get_version()

Method 5

The slight change in syntax is that after importingdjango , we need to writedjango.VERSION , but the output varies .

django.VERSION
(3, 2, 9, 'final', 0)
%d 博主赞过: