How to check Django version

后端 未结 26 2686
梦如初夏
梦如初夏 2020-12-04 04:36

I have to use Python and Django for our application. So I have two versions of Python, 2.6 and 2.7. Now I have installed Django. I could run the sample application for testi

26条回答
  •  孤街浪徒
    2020-12-04 05:21

    There are various ways to get the Django version. You can use any one of the following given below according to your requirements.

    Note: If you are working in a virtual environment then please load your python environment


    Terminal Commands

    1. python -m django --version
    2. django-admin --version or django-admin.py version
    3. ./manage.py --version or python manage.py --version
    4. pip freeze | grep Django
    5. python -c "import django; print(django.get_version())"
    6. python manage.py runserver --version

    Django Shell Commands

    1. import django django.get_version() OR django.VERSION
    2. from django.utils import version version.get_version() OR version.get_complete_version()
    3. import pkg_resources pkg_resources.get_distribution('django').version

    (Feel free to modify this answer, if you have some kind of correction or you want to add more related information.)

提交回复
热议问题