首页 > 解决方案 > rest-auth 登录或注册后 Nginx 返回服务器错误 500

问题描述

我正在尝试使用 rest-auth 在我的 django 应用程序上设置身份验证。它在开发服务器上完美运行,然后我推送到生产环境并在每次成功登录或注册后开始收到服务器错误 500。

这是我的 urls.py 文件:

urlpatterns = [
    path('admin/', admin.site.urls),
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),
    path('api/', include('backend.urls')),
]

这是我的 nginx 配置文件:

location /{
include proxy_params;
proxy_pass http://unix:/myapp/path/gunicorn.sock;
}

即使 /rest-auth/login 也可以正确打开每条路线,但是一旦我提交登录表单或注册表单,我就会收到服务器错误,但它永远不会在开发服务器上发生。

我试图在 nginx conf 中进行更改,但没有成功。其他所有路线都有效,这个问题可能出在 nginx 或 rest-auth 上(它适用于开发)吗?

标签: pythondjangonginxdjango-rest-auth

解决方案


推荐阅读