From 30846b75d1f8f99786dff9b23423506a3947f46b Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Wed, 4 Dec 2024 09:41:38 -0500 Subject: [PATCH 1/2] Use django_mongodb.parse_uri --- project_name/settings.py-tpl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/project_name/settings.py-tpl b/project_name/settings.py-tpl index cba377d..ca01883 100644 --- a/project_name/settings.py-tpl +++ b/project_name/settings.py-tpl @@ -10,6 +10,8 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/ """ +import django_mongodb + from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. @@ -73,15 +75,8 @@ WSGI_APPLICATION = '{{ project_name }}.wsgi.application' # Database # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases -DATABASES = { - "default": { - "ENGINE": "django_mongodb", - "NAME": "my_database", - # "USER": "my_username", - # "PASSWORD": "my_password", - # "OPTIONS": {...}, - }, -} +DATABASES = {} +DATABASES["default"] = django_mongodb.parse_uri("mongodb://localhost/{{ project_name }}") # Password validation # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators From b62f015582cbb7260d0e0b162fa06a53397932de Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Thu, 12 Dec 2024 11:23:56 -0500 Subject: [PATCH 2/2] Update project_name/settings.py-tpl Co-authored-by: Jib --- project_name/settings.py-tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project_name/settings.py-tpl b/project_name/settings.py-tpl index ca01883..e40c829 100644 --- a/project_name/settings.py-tpl +++ b/project_name/settings.py-tpl @@ -76,7 +76,7 @@ WSGI_APPLICATION = '{{ project_name }}.wsgi.application' # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#databases DATABASES = {} -DATABASES["default"] = django_mongodb.parse_uri("mongodb://localhost/{{ project_name }}") +DATABASES["default"] = django_mongodb.parse_uri("mongodb://localhost:27017/{{ project_name }}") # Password validation # https://docs.djangoproject.com/en/{{ docs_version }}/ref/settings/#auth-password-validators