I am very new at this and am trying to connect my django project with my mongodb using djongo.
I've set up mongo atlas and give myself the admin role.
to create a new project:
django-admin startproject mysite
I've created a database with nothing in it called demo_db that has no data written Then I change the settings.py database session into:
DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'demo_db',
'HOST': 'mongodb+srv://louisa:<password>@cluster0.ya1jd.mongodb.net/demo_db?retryWrites=true&w=majority',
'USER': 'louisa',
'PASSWORD': '<password>',
}
}
I am running atlas version 4.2. When I save the settings.py and run
python manage.py migrate
This is the output message:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
This version of djongo does not support "NULL, NOT NULL column validation check" fully. Visit https://www.patreon.com/nesdis
Applying contenttypes.0001_initial...This version of djongo does not support "schema validation using CONSTRAINT" fully. Visit https://www.patreon.com/nesdis
OK
Applying auth.0001_initial...This version of djongo does not support "schema validation using KEY" fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "schema validation using REFERENCES" fully. Visit https://www.patreon.com/nesdis
OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name...This version of djongo does not support "COLUMN DROP NOT NULL " fully. Visit https://www.patreon.com/nesdis
This version of djongo does not support "DROP CASCADE" fully. Visit https://www.patreon.com/nesdis
OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying sessions.0001_initial... OK
Everything seems fine, but when I take a look at the database via compass, or even on atlas, there is no new data table written at all rather than initiating some table.
The strangest thing is that when I later create admin profile or add data into the mongodb, even though it doesnt show anything on the console, I am able to get access to it through the django command.
I tried to write an object or two using pymongo without any problem, and i can use the host url to connect my local compass to my atlas, so this is not likely to be the problem either. Not sure what had gone wrong here.
pip3 install sqlparse==0.2.4
Reference: https://github.com/nesdis/djongo/issues/505
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With