connect ( user = 'a postgres user', password = 'password for the postgres user', host = '127.0.0.1', port = tunnel. SSHTunnelForwarder ( ( '' ), ssh_username = 'your PythonAnywhere username', ssh_password = 'the password you use to log in to the PythonAnywhere website', remote_bind_address = ( postgres_hostname, postgres_host_port ) ) as tunnel : connection = psycopg2. TUNNEL_TIMEOUT = 5.0 postgres_hostname = "" # You will have your own here postgres_host_port = 1234 # You will have your own port here with sshtunnel. Your Postgres database, you can install the sshtunnel packageĪnd then use code like this: import psycopg2 import sshtunnel sshtunnel. If you're running Python code on your local machine, and you want it to access There are a number of ways to do this: From Python code ¶
0 Comments
Leave a Reply. |