good day ! currently im stuck at step 15. There’s a message " AttributeError at /‘tuple’ object has no attribute ‘get’"
here’s my view and urls
Been stuck here for few days and looking forward for the guidance ! thanks alot
good day ! currently im stuck at step 15. There’s a message " AttributeError at /‘tuple’ object has no attribute ‘get’"
here’s my view and urls
Been stuck here for few days and looking forward for the guidance ! thanks alot
Hi! I am new to Python and Django but I was stuck with this error as well and just found the solution so I figured I’d share what I found and where I found the explanation.
Your return function needs to use the render function for django to generate an HTTP response. Your code should read:
from django.shortcuts import render
.# Create your views here.
def fortune(request):
return render(request, “randomfortune/fortune.html”)
Ignore the period before the #, I had to add it to stop it from formatting that line as a heading.
Here is where I found an explanation for what the render function does: python - How does "return render(request, 'path/path')" works in Django? - Stack Overflow
I hope that helps!
thanks !! it’s working now !!! been stuck here for so many days…really appreciate it
Thanks, it worked!
I forgot toput render in fortuneteller/views.py.
From this:
def fortune(request):
return(request, “randomfortune/fortune.html”)
To This:
def fortune(request):
return render(request, “randomfortune/fortune.html”)
Thanks, this helped me also.
I am also stuck on task 15. I’ve reset the exercise about seven times. I feel comfortable with the subject matter now but I can’t get past this task. Even though I’m in the fortune teller directory, when I start the server I get:
File “/usr/local/lib/python3.6/dist-packages/django/urls/conf.py”, line 34, in include
urlconf_module = import_module(urlconf_module)
File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘randomfortune.urls’
what is frozen importlib._bootstrap? My directory says the randomfortune.urls is there. So frustrating. Please help!