A very simple example of django and MongoDB implementation. I must say django is not maybe a correct example for this since we will not have use of django ORM, django Admin, etc.
Then seems like django is not fully used and maybe this is more a good option for some microservice - maybe with FastAPI, Flask or any other small framework.
Why I did this?
I was just curious!
Of course this could be a nice use case for storing some data, besides some relation DB that integrates with django.
In this example for communicating to MongoDB I used PyMongo package.
- Python 3.11+
- Poetry
- Install requirements:
poetry install
- Create .env file in root of your project (same level as manage.py)
- Update .env with your values (check .env.example file)
- Run server