Commit 1185b3d4 authored by Elia Ponzio's avatar Elia Ponzio
Browse files

Merge branch 'dev' of git.vshn.net:elia.ponzio/generic-monitoring into dev

parents 868631c4 afb508c9
......@@ -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
......@@ -82,12 +83,25 @@ WSGI_APPLICATION = 'project.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
......
......@@ -2,3 +2,4 @@ celery==5.1.1
redis==3.5.3
django-celery-beat==2.2.0
Django==3.2.4
django-cockroachdb>=3.2.1
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