且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

django-allauth配置疑惑

更新时间:2023-12-02 11:10:04

With respect to 1):

  • There is no collision as long as there is no overlap in the fully matched URL patterns. For example: if your accounts app has a match for "/accounts/login/" then there is indeed a collision as allauth is gunning for that URL as well. But, if your accounts app simply matches other URLs with /accounts/ as prefix then you are fine.

  • If you insist, you can indeed put allauth URLs below a different path. allauth uses name based URL reversal, so the new path prefix will be picked up automatically.

As for 2):

  • There is nothing special about allauth templates. You can override them just like you would for any other Django app.

  • Have a look at the example app. It has both Bootstrap and uniform template overrides. They can be enabled by uncommenting this line: https://github.com/pennersr/django-allauth/blob/901485557d4ddee30fed920f2159cdf499c39e1c/example/example/settings.py#L126

  • All allauth templates inherit from a base template, called base.html. I would expect that your project also has a base template. Either override the base.html with yours, or, override base.html with a template that extends from yourbase.html

3): allauth uses the Django messages framework. See: https://docs.djangoproject.com/en/dev/ref/contrib/messages/#expiration-of-messages -- if you do not iterate over the messages in order to display them, they do not expire. So apparently you are not showing the messages in your templates. Therefore, they heap up until the admin appears which renders (and clears) all messages collected so far...

4) Optional

5) There is no password set, meaning, the user can only login using the 3rd party account until he actually sets a password (/accounts/password/set/).