Raven fails to identify HEAD git revision for Django on Heroku

Sentry’s documentation for setting django says to put the following line in RAVEN_CONFIG in settings.py:

‘release’: raven.fetch_git_sha(os.path.dirname(file)),

This fails with the following error when pushing my Django app to Heroku:

remote: Traceback (most recent call last):
remote: File “manage.py”, line 9, in
remote: execute_from_command_line(sys.argv)
remote: File “/app/.heroku/python/lib/python2.7/site-packages/django/core/management/init.py”, line 338, in execute_from_command_line
remote: utility.execute()
remote: File “/app/.heroku/python/lib/python2.7/site-packages/django/core/management/init.py”, line 303, in execute
remote: settings.INSTALLED_APPS
remote: File “/app/.heroku/python/lib/python2.7/site-packages/django/conf/init.py”, line 48, in getattr
remote: self._setup(name)
remote: File “/app/.heroku/python/lib/python2.7/site-packages/django/conf/init.py”, line 44, in _setup
remote: self._wrapped = Settings(settings_module)
remote: File “/app/.heroku/python/lib/python2.7/site-packages/django/conf/init.py”, line 92, in init
remote: mod = importlib.import_module(self.SETTINGS_MODULE)
remote: File “/app/.heroku/python/lib/python2.7/importlib/init.py”, line 37, in import_module
remote: import(name)
remote: File “/app/sr_website/settings.py”, line 649, in
remote: ‘release’: raven.fetch_git_sha(os.path.dirname(file)),
remote: File “/app/.heroku/python/lib/python2.7/site-packages/raven/versioning.py”, line 25, in fetch_git_sha
remote: ‘Cannot identify HEAD for git repository at %s’ % (path,))
remote: raven.exceptions.InvalidGitRepository: Cannot identify HEAD for git repository at /app/myapp

How should I fix this?

Thanks,
Dan

I think heroku by default will catch the revision but you in case it doesnt can also do it yourself:

'release': os.environ['HEROKU_SLUG_COMMIT']

Looks like on heroku there is no need to set the release variable. Thanks!
It might make sense to update the onboarding documentation to mention that the release is optional on heroku.