1

I've connected my Django app with MongoDB, register/login/logout are all working fine. But when I use the Django default password reset email it throws a database error.

What I've tired:

  • sqlite3 - register/login/logout (Working)
  • MongoDB - register/login/logout (Working)
  • sqlite3 - password reset email (Working)
  • MongoDB - password reset email (NOT Working)

I was able to land on the Django password reset page, but when I hit confirm it return the error on the browser

DatabaseError at /pw_reset/
No exception message supplied
Request Method: POST
Request URL:    http://localhost:8000/pw_reset/
Django Version: 3.2.6
Exception Type: DatabaseError
Exception Location:  
C:...venv\lib\site-packages\djongo\cursor.py, line 59, in execute

The above exception ( Keyword: None Sub SQL: None FAILED SQL: ('SELECT "accounts_user"."id", "accounts_user"."password", "accounts_user"."last_login", "accounts_user"."is_superuser", "accounts_user"."username", "accounts_user"."first_name", "accounts_user"."last_name", "accounts_user"."email", "accounts_user"."is_staff", "accounts_user"."is_active", "accounts_user"."date_joined" FROM "accounts_user" WHERE ("accounts_user"."email" iLIKE %(0)s AND "accounts_user"."is_active")',) Params: (('[email protected]',),) Version: 1.3.6) was the direct cause of the following exception:

Console log:

Traceback (most recent call last):
  File "C:...\lib\site-packages\django\template\base.py", line 850, in _resolve_lookup   
    (bit, current))  # missing attribute
django.template.base.VariableDoesNotExist: Failed lookup for key [name] in <URLResolver <URLPattern list> (admin:admin) 'admin/'>

URL Path:

path('pw_reset/', auth_views.PasswordResetView.as_view(), name="reset_password"),

The Views I defined myself (register/login/logout) are all working fine. But the built-in one PasswordRestView is not. I've tried dropping the DB, reinstall djongo, I run out of ideas... Please help!

3
  • you can enable Django logging and read queries. then test queries in django dbshell Commented Aug 22, 2021 at 14:26
  • thanks @mrash it seems to be an error on a key "name". No idea what it's referring to... I've updated the question. Commented Aug 22, 2021 at 15:26
  • I thought "username" is the default when using AbstractUser, it's working and I can see the accounts_user created in MongoDB. That's why I don't understand where the "name" comes from. Commented Aug 22, 2021 at 15:30

1 Answer 1

0

Fixed by downgrading versions on:

Django==3.0.5
djongo==1.3.4
sqlparse==0.2.4
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.