-
In your local_settings.py file:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'django_%s' % (PROJECT_NAME,), 'USER': xxxx, 'PASSWORD': xxxx, 'HOST': 'localhost', 'PORT': '1234', } }
-
SSH to development server.
To connect to the production server, from the command line, run:
$ ssh -N -L 1234:localhost:5432 remote.com
- 1234 = local port
- 5432 = remote port
Important: Don't close shell window.
Note: After entering the above command, you won't get any feedback until you exit.
-
You might need to
$ touch
your wsgi file or restart Apache (Django development server restarts automatically).
Last active
July 26, 2023 15:22
-
-
Save mhulse/1954422 to your computer and use it in GitHub Desktop.
SSH Tunneling: Map port from remote machine to your local machine so you can work from the remote DB (example using Django DB settings)...
Yah! It's a quick way to get live data to work with. If you get this to work with WP, you might fork this file and leave a comment here with a link to your version. :)
For future reference, here's the discussion that spawned this gist via wp-hackers listserv.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh man! But it still a very good way for testing when you don't need the change the db.