集成Registration(django内置登录,注册,退出功能!快速实现业务逻辑,减少前端代码量)

django内置登录,注册,退出功能!快速实现业务逻辑,减少前端代码量。

 

  1. 允许注册:

    把下面两个app注册到settings.py的INSTALLED_APPS中:

    pip install django-registration-redux

     

  2. 添加到 apps 中

     

  3. 同步数据库

     

    python manage.py makemigrations
    python manage.py migrate
  4. 添加路由

    from django.conf.urls import include, url

    urlpatterns = [
       
        url(r'^accounts/', include('registration.backends.simple.urls')),
    ]
    
    
  5. 添加登陆,退出链接到页面中 

     

     
posted @ 2020-11-26 17:28  Lofty??  阅读(179)  评论(0编辑  收藏  举报