python - Heroku 无法导入名称“登录”
问题描述
由于我将 django 应用程序部署到 heroku,因此在打开项目时出现错误。它在本地工作得很好,但是在推送到 django 之后出现以下错误:
ImportError at /
cannot import name 'login'
Request Method: GET
Request URL: https://blooming-headland-56472.herokuapp.com/
Django Version: 2.1
Exception Type: ImportError
Exception Value:
cannot import name 'login'
Exception Location: /app/Clientes/urls.py in <module>, line 5
Python Executable: /app/.heroku/python/bin/python
Python Version: 3.6.6
Python Path:
['/app/.heroku/python/bin',
'/app',
'/app/.heroku/python/lib/python36.zip',
'/app/.heroku/python/lib/python3.6',
'/app/.heroku/python/lib/python3.6/lib-dynload',
'/app/.heroku/python/lib/python3.6/site-packages']
Server time: Sex, 24 Ago 2018 11:32:30 +0000
我的 urls.py 看起来像这样:
from django.urls import path
from . import views
from django.conf import settings
from django.contrib.auth import views as auth_views
from django.contrib.auth.views import (
login, logout, password_reset, password_reset_done,
password_reset_confirm
)
from django.conf.urls.static import static
app_name = 'client'
urlpatterns = [
path('register/', views.register, name='register'),
path('login/', login, {'template_name': 'Clientes/login.html'},
name='login'),
path('mail/', views.mail, name='mail'),
path('profile/config', views.config_view, name="config"),
path('profile/dashboard', views.dashboard_view, name="dashboard"),
path('reset-password/', password_reset, name="reset_password"),
path('reset-password/done/', password_reset_done,
name="password_reset_done"),
path('reset-password/confirm/', password_reset_confirm,
name="password_reset_confirm"),
path('profile/logout/', views.logout_view, name='logout'),
path('profile/', views.ProfileView.as_view(), name='profile'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
解决方案
推荐阅读
- android - 带有firebase firestore的Android studio java尝试使用新的增量
- asp.net - 单声道 TLS 错误 TLSV1_ALERT_PROTOCOL_VERSION
- pandas - 根据另一列区分列中的重复值
- lotus-notes - 有没有办法在 Lotus Notes 中创建自定义视图,只显示未读邮件?
- reactjs - 如何为 HOC 输入 props,它将包装反应路由器的 Route 组件
- php - CakePHP 3.8.6:即使没有注销,身份验证也不会阻止多次登录
- json - 将多个 json 对象添加到 Robotframework 上的 json
- reactjs - 何时使用 React.PropsWithChildren
- ssl - 带有 Django Channels 和 Daphne webserver 的 wss(安全 websocket)
- python - 如何在网络图中具有不同的边权重但边长相同?