django cannot import * problem

Asked 2 years ago, Updated 2 years ago, 47 views

I'm developing a site, but there's an error in the process of creating a login, how do I solve it ㅠ<

Import Error: Cannot import name 'LoginForm' project/account/forms.py

class SignupForm(UserCreationForm):
    email=forms.EmailField(
        required=True,
        widget=forms.EmailInput(
            attrs={
                'class':'form-control',
                'placeholder':'E-mail',
                'required':'True',
            }
        )
    )

project/urls.py

from django.conf.urls import url,include
from django.contrib import admin
from django.views.generic import TemplateView
from account.forms import LoginForm <-- This error
urlpatterns = [
#~~
    url(r'^login/$', 'django.contrib.auth.views.login',{'authentification_form':LoginForm}, name='login_url'),
    url(r'^logout/$', 'django.contrib.auth.views.logout',{'next_page':'/login/',}, name='logout_url'),
]

django python

2022-09-22 20:13

2 Answers

Does the _init__.py file exist in the project/account directory? If not, create a _init__.py file with an empty file,


2022-09-22 20:13

Maybe settings.Have you registered an app called account on pi's INSTALLED_APPS?


2022-09-22 20:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.