Get_git_version cannot find version number

In version.py there is a get_git_version() method, when I execute ./manage.py runserver , this error comes from the version.py file

raise ValueError ("Unable to find version number!")

 def get_git_version(abbrev=4): # Read in the version that currently in RELEASE-VERSION. release_version = read_release_version() # First try to get the current version using "git describe". version = call_git_describe(abbrev) # If that doesn't work, fall back on the value that in # RELEASE-VERSION. if version is None: version = release_version # If we still don't have anything, that an error. if version is None: raise ValueError("Cannot find the version number!") # If the current version is different from what in the # RELEASE-VERSION file, update the file to be current. if version != release_version: write_release_version(version) # Finally, return the current version. return version def read_release_version(): try: f = open("RELEASE-VERSION", "r") try: version = f.readlines()[0] return version.strip() finally: f.close() except: return None 
+6
source share
1 answer

This script expects the version number from either the annotated git tag ( call_git_describe() ), or searches for the version number in a file named RELEASE-VERSION . It fails because none of these two things are found, so fix one of them.

Run this in your project to create an annotated tag for the current commit:

 git tag 1.0 -m "this is version 1.0" 

I prefer tagging for version control, but the version in the text file is also good, YMMV.

+2
source

Source: https://habr.com/ru/post/916834/


All Articles