BaseSSHTunnelForwarderError django, python, linux (Ubuntu 22)

I was trying to run my django app (python framework v3.10.12, pip v24.0, django v4.2.5) on Linux (Ubuntu 22) and when executing the command python3 manage.py runserver I got this error message:

2024-02-28 15:58:07,627| ERROR | Could not open connection to gateway Traceback (most recent call last): File "/home/jheison/web_app/lambda_project/manage.py", line 22, in <module> main() File "/home/jheison/web_app/lambda_project/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/django/core/management/__init__.py", line 382, in execute settings.INSTALLED_APPS File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/django/conf/__init__.py", line 102, in __getattr__ self._setup(name) File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/django/conf/__init__.py", line 89, in _setup self._wrapped = Settings(settings_module) File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/django/conf/__init__.py", line 217, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/home/jheison/web_app/lambda_project/lambda_project/settings.py", line 96, in <module> ssh_tunnel.start() File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/sshtunnel.py", line 1331, in start self._raise(BaseSSHTunnelForwarderError, File "/home/jheison/.local/share/virtualenvs/web_app-yZNsHh7j/lib/python3.10/site-packages/sshtunnel.py", line 1174, in _raise raise exception(reason) sshtunnel.BaseSSHTunnelForwarderError: Could not establish session to SSH gateway

Note: I ran git clone xxxxx correctly, installed requirements.txt with pipenv install -r requirements.txt Note: I have already been given the correct access to the github directory as well in case this could be a problem. 1 week ago I was able to run the app correctly, but not anymore :c.

I tried reporting to the directory admin to give me greater access and add me as a collaborator in the github directory. I tried solutions like giving git from an ssh key but without results either.

  • Generally, after giving the command python manage.py runserver, a message should be generated containing a localhost:xxxx code, to access and be able to view the site in full and view the changes as I create it.
Back to Top