What is Xata?
Django

Connect to Postgres with Django

Edit on GitHub

Connecting to Xata with Django can be done by altering the settings.py file:

settings.py
DATABASES = {
  'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': '<DATABASE_NAME>:<BRANCH>',
    'USER': '<WORKSPACE_ID>',
    'PASSWORD': '<API_KEY>',
    'HOST': '<REGION>.sql.xata.sh',
    'PORT': '5432',
  }
}

Please replace the parameters as indicated on the connect to Postgres page.

For other options to bootstrap the database settings in Django, e.g. with environment variables, please refer to the project documentation.