首页 > 解决方案 > Django:“使用 Facebook 登录”按钮在部署到 pythonanywhere 后不起作用

问题描述

当我在 localhost 中运行该应用程序时,它工作正常。但部署到 pythonanywhere 后,使用 Facebook按钮登录不起作用。

当我刷新登录页面时,在控制台中,它显示 =>

Failed to load resource: https://username.pythonanywhere.com/static/facebook/js/fbconnect.js the server responded with a status of 404 (Not Found)

Refused to execute https://username.pythonanywhere.com/static/facebook/js/fbconnect.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

在模板中:

<a href="{% provider_login_url 'facebook' method='js_sdk' %}"><button class="effect" style="width: 100%; background-color: rgb(58, 110, 255); height: 36px; border: none; color: white; border-radius: 3px; display: flex; justify-content: center;align-items: center;"><img style="height: 24px; width: 24px; background-color: white; padding: 1px; border-radius: 50%;" src="{% static 'images/fblogo.png' %}" alt=""><span style="margin-top: 2px; display: block; margin-left: 8px; font-size: 16px;"> Login with Facebook</span></button></a> <br>

另一个问题是:CSS 没有加载到管理页面中

如何解决这个问题?

编辑:现在如果我点击“用 facebook 登录”按钮,它会显示,ReferenceError: Can't find variable: allauth

现在要做什么?

标签: djangofacebookdjango-allauthpythonanywhere

解决方案


推荐阅读