django-配置静态页面

Posted yifengs

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django-配置静态页面相关的知识,希望对你有一定的参考价值。

报错

[2019-10-02 21:22:37,447: INFO/MainProcess] Received task: celery_tasks.tasks.generate_static_index_html[cf352555-b383-4f35-b99a-819de89df202]  
[2019-10-02 21:22:37,715: ERROR/ForkPoolWorker-1] Task celery_tasks.tasks.generate_static_index_html[cf352555-b383-4f35-b99a-819de89df202] raised unexpected: NoReverseMatch("Reverse for ‘detail‘ with arguments ‘(5,)‘ and keyword arguments ‘‘ not found. 0 pattern(s) tried: []",)
Traceback (most recent call last):
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/core/urlresolvers.py", line 565, in reverse
    extra, resolver = resolver.namespace_dict[ns]
KeyError: dailyfresh.goods

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/defaulttags.py", line 501, in render
    current_app=current_app)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/core/urlresolvers.py", line 575, in reverse
    key)
django.core.urlresolvers.NoReverseMatch: dailyfresh.goods is not a registered namespace

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/celery/app/trace.py", line 382, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/celery/app/trace.py", line 641, in __protected_call__
    return self.run(*args, **kwargs)
  File "/home/python/bj18/ttsx/dailyfresh/celery_tasks/tasks.py", line 73, in generate_static_index_html
    static_index_html = temp.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/backends/django.py", line 74, in render
    return self.template.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 209, in render
    return self._render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 201, in _render
    return self.nodelist.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 903, in render
    bit = self.render_node(node, context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/debug.py", line 79, in render_node
    return node.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/loader_tags.py", line 135, in render
    return compiled_parent._render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 201, in _render
    return self.nodelist.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 903, in render
    bit = self.render_node(node, context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/debug.py", line 79, in render_node
    return node.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/loader_tags.py", line 65, in render
    result = block.nodelist.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/base.py", line 903, in render
    bit = self.render_node(node, context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/debug.py", line 79, in render_node
    return node.render(context)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/defaulttags.py", line 217, in render
    nodelist.append(node.render(context))
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/defaulttags.py", line 507, in render
    six.reraise(*exc_info)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/utils/six.py", line 659, in reraise
    raise value
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/template/defaulttags.py", line 493, in render
    url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/core/urlresolvers.py", line 579, in reverse
    return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/home/python/.virtualenvs/bj18_py3/lib/python3.5/site-packages/django/core/urlresolvers.py", line 496, in _reverse_with_prefix
    (lookup_view_s, args, kwargs, len(patterns), patterns))
django.core.urlresolvers.NoReverseMatch: Reverse for detail with arguments (5,) and keyword arguments  not found. 0 pattern(s) tried: []

 

以上是关于django-配置静态页面的主要内容,如果未能解决你的问题,请参考以下文章

Django 2.11 静态页面404 解决

Django中通过定时任务触发页面静态化的方式

django -静态文件能加载进入,但是在页面上却显示不出来

在 Django 中显示静态页面

django静态文件处理

django-配置静态资源