Commit afb508c9 authored by Stephan Feurer's avatar Stephan Feurer
Browse files

Add cockroach to the settings

parent f48ef546
......@@ -21,6 +21,16 @@ We will use celery as queue with its [periodic task](https://docs.celeryproject.
### Database
A ORM will help us, TBD.
#### CockroachDB - insecure
* start database (docker-compose)
* login to database: `cockroach sql --insecure`
* create user: `CREATE USER cynomys;`
* create database: `CREATE DATABASE cynomys;`
* grant user access to db: `GRANT ALL ON cynomys TO cynomys;`
Use cockroachdb as django backend: `DJANGO_DATABASE='cockroach-insecure' ./manage.py xxx`
## Install
```
......
......@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
from os import environ
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -75,12 +76,25 @@ WSGI_APPLICATION = 'cynomys.wsgi.application'
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'sqlite': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
},
'cockroach-insecure': {
'ENGINE' : 'django_cockroachdb',
'USER' : 'cynomys',
'PASSWORD': '',
'HOST' : 'localhost',
'PORT' : 26257,
'NAME' : 'cynomys',
'OPTIONS': {
'sslmode': 'disable'
}
}
}
default_database = environ.get('DJANGO_DATABASE', 'sqlite')
DATABASES['default'] = DATABASES[default_database]
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment