如何使用Djangoallauth使用google登录链接到我的登录页面?

2024-09-30 12:17:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经创建了一个工作良好的项目。 我有一个登录页面、注册页面和个人资料页面(如myspace)。我只想在我的登录页面上添加一个附加功能,用户可以使用google、fb或instagram登录。但是当我把django allauth添加到我的项目中时。它将覆盖现有的登录页面。 我只想添加一个谷歌登录图标。而不是整页我怎么能做到

my login page looks like this earlier and at bottom i added a google icon in which i want to add the functionality of auth app

login pages is looking like this for now

更新:-

我想的是django allauth是如何工作的,我只需要在登录页面中添加一个带有<a href >标记的url,标记为'allauth/google'或类似的内容

我看到的是,我需要在urls.py中为allauth添加一个新路径,该路径将自动创建登录、注册和配置文件页面

我发现的问题是

我的项目中有一个帐户应用程序。accounts_app的url与allauth相同,这就是它覆盖模板的原因

camorid_项目的url.py

urlpatterns = [
    path('', include('camroid_app.urls')),
    path('accounts_app/', include('accounts_app.urls')), -----i want to add allauth functionality to this url
    path('accounts/', include('allauth.urls')),    -------------i don't want to add this because it create an inbuilt templates

    path('admin/', admin.site.urls),
]

我想要的是,我不想改变登录、注册和myspace页面,我想在我的登录页面中添加一个图标,点击谷歌登录,用户就可以登录到该网站


Tags: topath项目addappurlincludegoogle

热门问题