When using method-based view, redirecting with reverse
didn't complain about this and can still find the root url conf. But, in class-based views, it complain:
ImproperlyConfigured at /blog/new-post/
The included urlconf 'blog.urls' 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.
My class is defined like this:
class BlogCreateView(generic.CreateView):
form_class = Blog
template_name = 'blog/new-post.html'
success_url = reverse('blog:list-post')
How to properly use reverse
for success_url
in class-based views? Thanks.
PS: And I'm interested in why it's need to restart runserver
after this error (not like an error like TemplateDoesNotExists
which is no need to restart runserver
)