如何修复ImportError:无法从'django.http'中导入名称'HTTpResponse'

问题描述 投票:0回答:1

经过几次试验,我仍然得到相同的结果

ImportError: cannot import name 'HTTpResponse' from 'django.http' (/Users/mac/my_env/lib/python3.7/site-packages/django/http/__init__.py) after running '$ python manage.py runserver'

在终端中。有人可以启发我这个问题吗?谢谢!

以下代码最初取自其官方网站上的Django教程。

from django.shortcuts import render
from django.http import HTTpResponse

def index(request):    
    return HTTpResponse("Hello, world. You're at the polls index.")
python django httpresponse
1个回答
0
投票

尝试一下:

from django.http import HttpResponse

随机大写的原因是什么?

© www.soinside.com 2019 - 2024. All rights reserved.