django.core.exceptions.ImproperlyConfigured: The included URLconf 'xsite.urls' does not appear to ha

问题

django.core.exceptions.ImproperlyConfigured: The included URLconf ‘xsite.urls’ does not appear to have any patterns in it.

File "C:\Programs\Miniconda3\envs\djg2env\lib\site-packages\django\urls\base.py", line 58, in reverse
    app_list = resolver.app_dict[ns]
  File "C:\Programs\Miniconda3\envs\djg2env\lib\site-packages\django\urls\resolvers.py", line 513, in app_dict
    self._populate()
  File "C:\Programs\Miniconda3\envs\djg2env\lib\site-packages\django\urls\resolvers.py", line 447, in _populate
    for url_pattern in reversed(self.url_patterns):
  File "C:\Programs\Miniconda3\envs\djg2env\lib\site-packages\django\utils\functional.py", line 80, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Programs\Miniconda3\envs\djg2env\lib\site-packages\django\urls\resolvers.py", line 593, in url_patterns
    raise ImproperlyConfigured(msg.format(name=self.urlconf_name))
django.core.exceptions.ImproperlyConfigured: The included URLconf 'xsite.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.

Django 高级实战编程

Django高级实战 开发企业级问答网站
项目结合:需求分析/Django高级用法/算法/设计模式/TestCase测试/云计算服务

Django开发企业实战 面向就业/升职(中高级教程)

视频教程分享地址:
https://study.163.com/course/introduction/1209407824.htm?share=2&shareId=400000000535031

出错代码

class ArticleUpdateView(LoginRequiredMixin, UpdateView):
    model = Article
    form_class = ArticleForm
    context_object_name = 'form'
    template_name = 'aiblogs/article_update_form.html'
    success_url = reverse('blogs:article-list')

    def get_context_data(self, *args, **kwargs):
        context = super(ArticleUpdateView, self).get_context_data(*args, **kwargs)
        context['albums'] = Album.objects.filter(blog=self.request.user.myblog).order_by('indx')
        return context

不出错代码

class ArticleUpdateView(LoginRequiredMixin, UpdateView):
    model = Article
    form_class = ArticleForm
    context_object_name = 'form'
    template_name = 'aiblogs/article_update_form.html'
    # success_url = reverse('blogs:article-list')

    def get_context_data(self, *args, **kwargs):
        context = super(ArticleUpdateView, self).get_context_data(*args, **kwargs)
        context['albums'] = Album.objects.filter(blog=self.request.user.myblog).order_by('indx')
        return context

    def get_success_url(self):
        return reverse('blogs:article-list')
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值