Forums

How do I connect a free ElephantSQL postgresql server to pythonanywhere?

Hi,

I have setup a server on ElephantSQL to handle my website's postgresql requirements. I have a paid account here on pythonanywhere. I'm new to this and I don't see any tutorial on how to access a remote postgresql database from my webapp on pythonanywhere. There is an article about connecting to a remote MySQL database, but none for connecting to a remote postgresql database.

I read about SSH tunneling at the following link, but this requires a postgres server hostname from the postgres tab in pythonanywhere. I can't get that because I'd have to pay for postgres service to access that, but I thought that accessing remotely was free. https://stackoverflow.com/questions/49100598/how-to-save-to-a-remote-server-with-django?noredirect=1&lq=1

Could you please give me a brief explanation of how I would do so or point me in the right direction?

Many thanks, Joe

If you have an external postgres server, eg: at your.elephant.sql.server.address.com, then you would just use that in your source / config code? You won't need to do anything extra.

Note: there is also this https://help.pythonanywhere.com/pages/Postgres/ to be aware of

Very true!

The worst part about pythonanywhere, you cannot connect an external postgres db with it on a free tier account. Really disappointed!!! There is no point of free tier without a db. How are we supposed to use a django app without a postgres database when we really need some extra features in it.

You can use MySQL on a free account, see this, if you want to connect to external services, you'd need a paid account though.