In version.py
there is a method get_git_version()
when I execute ./manage.py runserver
this error is raised from version.py
file
raise ValueError("Cannot find the version number!")
def get_git_version(abbrev=4):
# Read in the version that's 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's in
# RELEASE-VERSION.
if version is None:
version = release_version
# If we still don't have anything, that's an error.
if version is None:
raise ValueError("Cannot find the version number!")
# If the current version is different from what's 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
This script is expecting a version number either from a git annotated tag (call_git_describe()
), or by looking 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 annotated tag for the current commit:
git tag 1.0 -m "this is version 1.0"
I tend to prefer tagging for version management, but version in a text file is also good, YMMV.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With