Visit the Community Forum to learn more and ask any questions you have!

How to connect to PostgreSQL

Back to Thread List

Circumeo automatically creates a new PostgreSQL database for each project, whether that project was created from scratch, uploaded, or imported from GitHub.

You can connect to your database with a DATABASES block similar to the following:

import os

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": os.environ["POSTGRES_DB"],
        "USER": os.environ["POSTGRES_USER"],
        "PASSWORD": os.environ["POSTGRES_PASSWORD"],
        "HOST": os.environ["POSTGRES_HOST"],
        "PORT": os.environ["POSTGRES_PORT"],
    }
}

The PostgreSQL connection environment variables will be automatically available to your Django app.

You can export your database at any time by visiting the Settings tab and triggering an export there.

by zach on Feb. 3, 2025, 11:59 a.m.

Replies

There are no replies yet.

Reply to this thread