We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36c5718 commit 1161948Copy full SHA for 1161948
django_mongodb/utils.py
@@ -6,6 +6,7 @@
6
from django.core.exceptions import ImproperlyConfigured
7
from django.db.backends.utils import logger
8
from django.utils.version import get_version_tuple
9
+from pymongo.uri_parser import parse_uri
10
11
12
def check_django_compatability():
@@ -25,6 +26,16 @@ def check_django_compatability():
25
26
)
27
28
29
+def parse(uri):
30
+ uri = parse_uri(uri)
31
+ return {
32
+ "ENGINE": "django_mongodb",
33
+ "HOST": uri["fqdn"] or None,
34
+ "USERNAME": uri.get("username"),
35
+ "PASSWORD": uri.get("password"),
36
+ }
37
+
38
39
def set_wrapped_methods(cls):
40
"""Initialize the wrapped methods on cls."""
41
if hasattr(cls, "logging_wrapper"):
0 commit comments