![]() ![]() To be a Postgres server running on your machine but actually sends data over SSH to your PythonAnywhere Manual SSH tunnelling ¶įor other tools that you want to run on your own machine, you can set up a tunnel that pretends If you're getting intermittent connection errors, try increasing one or both of If you have trouble with the SSH Tunnel connection, the project provides a This example uses the psycopg2 library, but you can use any Postgres local_bind_port, database = 'your database name', ) # Do stuff inside the context manager block connection. 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 ¶ If you're using our EU-hosted site at eu., then the.If you're using our global, US-hosted site at then the.However, if you have a paid account, you can access your databaseįrom outside using a technique called an SSH tunnel, which essentially makesĪ secure SSH connection to our systems, then sends the Postgres stuff over it. PostgreSQL databases on PythonAnywhere are protected by a firewall, so external Warning - this will only work in paid accounts ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |