How to check Django version

后端 未结 26 2557
梦如初夏
梦如初夏 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:24

    If you want to make Django version comparison, you could use django-nine (pip install django-nine). For example, if Django version installed in your environment is 1.7.4, then the following would be true.

    from nine import versions
    
    versions.DJANGO_1_7 # True
    versions.DJANGO_LTE_1_7 # True
    versions.DJANGO_GTE_1_7 # True
    versions.DJANGO_GTE_1_8 # False
    versions.DJANGO_GTE_1_4 # True
    versions.DJANGO_LTE_1_6 # False
    
    0 讨论(0)
  • 2020-12-04 05:25

    Go to your Django project home directory and do:

    ./manage.py --version
    
    0 讨论(0)
  • 2020-12-04 05:25

    go the setting of the Django Project. there find your Django Version.

    0 讨论(0)
  • 2020-12-04 05:29
    >>> import django
    >>> print(django.get_version())
    1.6.1
    

    I am using the IDLE (Python GUI).

    0 讨论(0)
  • 2020-12-04 05:29

    There is an undocumented utils versions module in Django:

    https://github.com/django/django/blob/master/django/utils/version.py

    With that, you can get the normal version as a string or a detailed version tuple:

    >>> from django.utils import version
    >>> version.get_version()
    ... 1.9
    >>> version.get_complete_version()
    ... (1, 9, 0, 'final', 0)
    
    0 讨论(0)
  • 2020-12-04 05:29

    After django 1.0 you can just do this

    $ django-admin --version
    1.11.10
    
    0 讨论(0)
提交回复
热议问题