A library light for integrate Django with MongoDB
pip install django-mongolight
- Use
- Configura tu base de datos en settings.py:
DATABASES = {
'default': {
'ENGINE': 'mongolight',
'NAME': 'mydatabase',
'HOST': 'localhost',
'PORT': 27017,
}
}
2.Create models:
from django.db import models
from mongolight.fields import ObjectIdField
class User(models.Model):
_id = ObjectIdField(primary_key=True)
name = models.CharField(max_length=100)