Support database url

This commit is contained in:
Gabriel Augendre 2019-03-02 16:31:09 +01:00
parent 5fd7f33c79
commit c3a973b6c7
3 changed files with 13 additions and 8 deletions

View file

@ -7,6 +7,7 @@ name = "pypi"
django = "*" django = "*"
gitpython = "*" gitpython = "*"
django-crispy-forms = "*" django-crispy-forms = "*"
dj-database-url = "*"
[dev-packages] [dev-packages]

10
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "a641d67a7e9f7c8b91008ec1d74563f65757dd900d38c5901f7fa3a450dc2be4" "sha256": "39ab492fa50cd7fb74e60bbd0e7cd1c5b688905cd90c256ff776d06f530af4fb"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@ -16,6 +16,14 @@
] ]
}, },
"default": { "default": {
"dj-database-url": {
"hashes": [
"sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163",
"sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9"
],
"index": "pypi",
"version": "==0.5.0"
},
"django": { "django": {
"hashes": [ "hashes": [
"sha256:275bec66fd2588dd517ada59b8bfb23d4a9abc5a362349139ddda3c7ff6f5ade", "sha256:275bec66fd2588dd517ada59b8bfb23d4a9abc5a362349139ddda3c7ff6f5ade",

View file

@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
import os import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -77,13 +79,7 @@ WSGI_APPLICATION = 'friends_map.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases # https://docs.djangoproject.com/en/2.1/ref/settings/#databases
DATABASES = {'default': dj_database_url.config(default=f'sqlite:///{BASE_DIR}/db.sqlite3', conn_max_age=600)}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation # Password validation