24.[09/Jun/2024 08:49:46] "GET /static/images/logo.png HTTP/1.1" 404 1805
[09/Jun/2024 08:49:46] "GET /static/images/background.jpg HTTP/1.1" 404 1823
404无法找到
绝对地址错误,修改一下,
25.Invalid block tag on line 26: 'static', expected 'endblock'. Did you forget to register or load this tag?
这个错误是没有导入静态语句
解决方法,再最前面导入这个语句
<!DOCTYPE html> {% load static %} <html lang="en">
26.用户密码正确,登录失败
首先确保去调取MYSQL库中的表查看,账号密码确保这一块没有错误
然后,我尝试了用加密后的密码进行登录,发现成功了
定位:在login这个函数中,判断输入密码和库中的密码是否相等时,没有将输入的密码也进行转换为加密
pwd = md5(pwd)
27.unsupported operand type(s) for +=: 'float' and 'decimal.Decimal'
total_run, created = RunTotal.objects.get_or_create(user=user, defaults={'total_distance': 0.00, 'week_distance': 0.00})
转换为相同的类型,这里转换为decimal.Decimal
类型进行计算
total_run, created = RunTotal.objects.get_or_create( user=user, defaults={'total_distance': decimal.Decimal('0.00'), 'week_distance': decimal.Decimal('0.00')})