Jhorra Jhorra - 1 month ago 16
Python Question

Use Azure DocumentDB as database for Django Rest Framework

I'm trying to find any way to use the Azure DocumentDb with the Django Rest Framework. I know there isn't much information in this question, but thus far I have found nothing through searching on how to do this. Can anyone point me to info or documentation on this?

From what I've read it seems like Django is mainly geared towards using relational databases, but I have seen some people use it with MongoDB. Being new to Django, specifically what I believe I'm looking for is what to change here in the settings:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

Answer

If it works out of the box with MongoDB, try using the MongoDB driver-level compatibility mode for DocumentDB. Since Django is designed with any database in mind, I suspect that it's not using the more esoteric aspects of MongoDB that are not supported by the MongoDB API for DocumentDB so I think there is a good chance it will work.

Comments