File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 11import os
22
3- from django_mongodb_backend import parse_uri
3+ from pymongo . uri_parser import parse_uri
44
55if mongodb_uri := os .getenv ("MONGODB_URI" ):
6- db_settings = parse_uri (mongodb_uri , db_name = "dummy" )
7-
6+ db_settings = {
7+ "ENGINE" : "django_mongodb_backend" ,
8+ "HOST" : mongodb_uri ,
9+ }
810 # Workaround for https://github.com/mongodb-labs/mongo-orchestration/issues/268
9- if db_settings ["USER" ] and db_settings ["PASSWORD" ]:
10- db_settings ["OPTIONS" ].update ({"tls" : True , "tlsAllowInvalidCertificates" : True })
11+ uri = parse_uri (mongodb_uri )
12+ if uri .get ("username" ) and uri .get ("password" ):
13+ db_settings ["OPTIONS" ] = {"tls" : True , "tlsAllowInvalidCertificates" : True }
1114 DATABASES = {
1215 "default" : {** db_settings , "NAME" : "djangotests" },
1316 "other" : {** db_settings , "NAME" : "djangotests-other" },
You can’t perform that action at this time.
0 commit comments