mongodb-labs / django-mongodb

MongoDB Backend for Django
Apache License 2.0
16 stars 7 forks source link

INTPYTHON-424 Support passing URLs via `django_mongodb.parse` #195

Open aclark4life opened 12 hours ago

aclark4life commented 12 hours ago

Supersedes #194

Todo

aclark4life commented 12 hours ago

This is working for me with an Atlas URI

Screenshot 2024-11-25 at 9 01 50 PM

Settings

import django_mongodb
import os

DATABASES = {
    "default": {
        "ENGINE": "django_mongodb",
        "NAME": "djangotests",
    },
    "other": {
        "ENGINE": "django_mongodb",
        "NAME": "djangotests-other",
    },
}
DEFAULT_AUTO_FIELD = "django_mongodb.fields.ObjectIdAutoField"
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
SECRET_KEY = "django_tests_secret_key"
USE_TZ = False
DATABASE_URL = os.environ.get("DATABASE_URL", "mongodb://localhost:27017/djangotests")
DATABASES["default"] = django_mongodb.parse(DATABASE_URL)