user13957019
user13957019

Reputation:

Django valid URL in url file not being found . Instead a circular error is being shown

This my views file where I am trying to use a usercreationform

from django.views import generic
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy


class UserRegisterView(generic.CreateView):
    form_class = UserCreationForm
    template_name = 'registration/register.html'
    success_url = reverse_lazy('home')

And this is my url file where I point to this view

from .views import UserRegisterView
from django.urls import path

url_patterns = [
    path('register/', UserRegisterView.as_view(), name="register"),

]

Now when I try to run the server , I am getting this error for some reason

django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'members.urls' from does not appear
to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

This does not make any sense . There is already a url pattern in it pointing to my view .

Upvotes: 2

Views: 70

Answers (1)

JPG
JPG

Reputation: 88579

It should be urlpatterns instead of url_patterns

Upvotes: 2

Related Questions