1. David Larlet
  2. django-storages
  3. Issues

Issues

Issue #135 invalid

SFTPStorage.save falls on Heroku with RuntimeError: maximum recursion depth exceeded

Andrey Gerzhov
created an issue

The reason is /app/.ssh/known_hosts does not exists.

Stacktrace:

[...] /app/.heroku/venv/lib/python2.7/site-packages/storages/backends/sftpstorage.pyc in _mkdir(self, path) 154 parent = self._pathmod.dirname(path) 155 if not self.exists(parent): --> 156 self._mkdir(parent) 157 self.sftp.mkdir(path) 158

/app/.heroku/venv/lib/python2.7/site-packages/storages/backends/sftpstorage.pyc in _mkdir(self, path) 153 necessary.""" 154 parent = self._pathmod.dirname(path) --> 155 if not self.exists(parent): 156 self._mkdir(parent) 157 self.sftp.mkdir(path)

/app/.heroku/venv/lib/python2.7/site-packages/storages/backends/sftpstorage.pyc in exists(self, name) 190 remote_path = self._remote_path(name) 191 try: --> 192 self.sftp.stat(remote_path) 193 return True 194 except IOError:

/app/.heroku/venv/lib/python2.7/site-packages/storages/backends/sftpstorage.pyc in sftp(self) 122 """Lazy SFTP connection""" 123 if not hasattr(self, '_sftp'): --> 124 self._connect() 125 return self._sftp 126

/app/.heroku/venv/lib/python2.7/site-packages/storages/backends/sftpstorage.pyc in _connect(self) 88 89 def _connect(self): ---> 90 self._ssh = paramiko.SSHClient() 91 92 if self._known_host_file is not None:

/app/.heroku/venv/lib/python2.7/site-packages/paramiko/client.pyc in init(self) 119 Create a new SSHClient. 120 """ --> 121 self._system_host_keys = HostKeys() 122 self._host_keys = HostKeys() 123 self._host_keys_filename = None

RuntimeError: maximum recursion depth exceeded

Comments (1)

  1. Rich Leland

    Thanks for reporting Andrey. The SFTP backend has a setting called SFTP_STORAGE_PARAMS. Items specified here get passed in to the underlying SSH library Paramiko and its connect() method.

    Take a look at https://bitbucket.org/david/django-storages/src/2d9e8ee48e71/storages/backends/sftpstorage.py?at=default#cl-15 and http://www.lag.net/paramiko/docs/paramiko.SSHClient-class.html#connect for more details.

    Depending on how your SFTP server is configured, you may have to use one ore more of the arguments to Paramiko's connect() method.

    Hope this helps!

  2. Log in to comment