Connect Postgres to a remote server(pgAdmin4)

Step 1: Create a server. Right-click on “Server” -> Register -> Server.

Create server

Step 2: Add the following details.

General tab

  • Name: w3wiki

Connection tab

  • Hostname/Address : <HOST>
  • Port: 5432
  • Maintenance database : <DATABASE>
  • Username : <USER>
  • Password: <PASSWORD>

SSL tab 

Choose “require” from the dropdown.

Advanced tab 

db restriction : <DATABASE> 

Once you add a database to DB restriction, hit enter to create a database and click on save.

View database tables

  • w3wiki(server name) –> Databases –> <DATABASE> –> Schemas –> Public –> Tables
  • Right-click on the table you want to view and select “View/Edit Data”.

Finally, we have deployed the Django application on Heroku with Postgres Backend. Let’s test it now!

 



Deploying Django App on Heroku with Postgres as Backend

Django is a high-level Python web framework used to create web applications without any hassle, whereas, PostgreSQL is a powerful, open-source object-relational database. Let us first create a Django application with PostgreSQL in the backend and deploy it in Heroku which is a container-based cloud Platform to deploy, manage, and scale the applications. 

Similar Reads

Packages Required

Python Django Postgres Virtual Environment Git...

File Structure

Project folder...

Set-up virtual environment :

In your terminal, use the following commands to set up a virtual environment for this tutorial. This will allow you to have a development environment independent of the host operating system....

Create Django application

Step 1. Django project set-up...

Heroku Postgres and deployment

...

Push to GitHub

...

Connect Postgres to a remote server(pgAdmin4)

...

Contact Us