How to setup my newly created managed DB, using PSQL on my Droplet

Good morning, I am attempting to deploy a Django app on a DO Droplet and connect it to a DO managed postgresql instance and I am running into an interesting problem. I have set up numerous Django apps in the past but all on a private company network so the security was never an issue. This is my first attempt on DO with a public app. I run my connection string on the droplet server and appear to make a successful connection. I get a message regarding the protocol and cipher for the SSL connection and I get a PSQL prompt, as expected. I run a CREATE DATABASE statement successfully. When I list the databases, I see my newly created database. But, when I try to run a PSQL connection statement I get this error:

connection to server at “[database name from connection string]” (10.x.x.x), port 25061 failed: FATAL: no such database: [newly created database]

connection to server at “[database name from connection string]” (10.x.x.x), port 25061 failed: FATAL: SSL required


How can I use PSQL from my droplet to configure the DB and make sure the app runs when I install it? Thanks in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

    Site Moderator
    Site Moderator badge
    November 22, 2023

    Heya @benandreas,

    Using Ubuntu 22.04 should be fine.

    Can you please make sure you’ve done all the following steps/commands before trying the PSQL connection statement:

    CREATE DATABASE SomethingName;
    \c SomethingName;
    CREATE USER SomethingUserName WITH PASSWORD 'SomethingPassword';
    ALTER ROLE SomethingUserName SET client_encoding TO 'utf8';
    ALTER ROLE SomethingUserName SET default_transaction_isolation TO 'read committed';
    ALTER ROLE SomethingUserName SET timezone TO 'UTC';

    And see how it goes?

    Remember to change

    • SomethingName - with your actual DB name
    • SomethingUserName with your actual User you want to use
    • SomethingPassword with the password you want to use.

    After that make sure to add the new information in your - ~/django-polls/mysite/

        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': 'SomethingName',
            'USER': 'SomethingUserName',
            'PASSWORD': 'SomethingPassword',
            'HOST': 'managed_db_host',
            'PORT': 'managed_db_port',

    Additionally, what exactly is the statement? Can you share it so that I can try and recreate the issue on my end?

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel