The collect static runs fine when it is executed manually from the command line, but it fails with sentry's built-in git function
But I know this is not sentry problem, because the problem occurs when I use gitpython to retrieve the git path
source /home/ubuntu/.virtualenvs/myproject/bin/activate && python /home/ubuntu/myproject/manage.py collectstatic -v 1 --noinput
Traceback (most recent call last):
File "/home/ubuntu/myproject/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 303, in execute
settings.INSTALLED_APPS
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/conf/__init__.py", line 44, in _setup
self._wrapped = Settings(settings_module)
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/conf/__init__.py", line 92, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ubuntu/myproject/myproject/settings/prod.py", line 100, in <module>
"release": raven.fetch_git_sha(os.path.dirname(os.pardir)),
File "/home/ubuntu/.virtualenvs/myproject/local/lib/python2.7/site-packages/raven/versioning.py", line 25, in fetch_git_sha
'Cannot identify HEAD for git repository at %s' % (path,))
raven.exceptions.InvalidGitRepository: Cannot identify HEAD for git repository at
Here is another example where fabric would fail while the local execution will be okay:
from git import Repo
from . import appname
import os
print appname.__path__
base_dir = os.path.dirname(appname.__path__[0])
repo = Repo(base_dir)
dt = repo.head.commit.committed_date
the appname's path will be empty. I am using from fabric.context_managers import cd
for all my fabric tasks.