由<function check_errors。<locals =“”>。wrapper在0x7fdd43044d90>启动的线程中未处理的异常

时间:2019-04-23 19:56:48

标签: python django sqlite

我在Ubuntu的virtualenv中用Django 2.0.7在python 3.6.7中做一个简单的待办事项清单,当我用样式(static / css / styles.css),我更改了settings.py并添加了以下内容:

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static'),
]

更多之后,我在base.html中创建了一个到样式的链接: <link rel="stylesheet" href="{% static 'css/styles.css' %}" />

这是我的控制台输出:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f4061a4bd90>
Traceback (most recent call last):
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 120, in inner_run
    self.check(display_num_errors=True)
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/core/management/base.py", line 364, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/core/management/base.py", line 351, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/core/checks/registry.py", line 73, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/mario/Dev/ToDo/lib/python3.6/site-packages/django/core/checks/urls.py", line 101, in check_url_settings
    if value and not value.endswith('/'):
AttributeError: 'tuple' object has no attribute 'endswith'

1 个答案:

答案 0 :(得分:0)

在您的settings.py中,检查STATIC_URLMEDIA_URL设置后是否有逗号结尾。看来您的代码将它们误认为一个元组。