Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Elia Ponzio
cynomys
Commits
afb508c9
Commit
afb508c9
authored
Jun 24, 2021
by
Stephan Feurer
Browse files
Add cockroach to the settings
parent
f48ef546
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
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
```
...
...
cynomys/settings.py
View file @
afb508c9
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment