Reputation: 93
I'm developing an app that will run in an mobile device and connect to a PostGreSQL database in my computer. To connect the mobile device to the server I need to give my computer's IP as 'host' parameter in the following code? I'm using the psycopg2 to set the connection between python and PostGres.
conpgs = psycopg2.connect(host='localhost', database='database', user='postgres', password='xxxx')
Upvotes: 0
Views: 816
Reputation: 28673
You can get your IP from services such as http://www.whatsmyip.org/
However, you are very likely on a local network, e.g., that of your local wifi/router. That means that you will need to work with the firewall options of whatever that interface is, in order for external connections to some port gets forwarded to the port PG is listening on on your machine.
Upvotes: 1