Thank you for your helpful answer.
Unfortunately Loading URL: http://usermj.pythonanywhere.com/owner now causes an other error:
It appears that there is a Django error on this page
--> Some Details:
AttributeError at /owner
127303 characters of HTML retrieved
AttributeError at /owner
module 'polls.views' has no attribute 'owner'
Request Method: GET
Request URL: http://usermj.pythonanywhere.com/owner
Django Version: 3.2.5
Exception Type: AttributeError
Exception Value: module 'polls.views' has no attribute 'owner'
Exception Location: /home/usermj/django_projects/mysite/polls/urls.py, line 7, in <module>
Python Executable: /usr/local/bin/uwsgi
Python Version: 3.9.5
Python Path: ['/home/usermj/django_projects/mysite',
'/var/www',
'.',
'',
'/var/www',
'/usr/local/lib/python39.zip',
'/usr/local/lib/python3.9',
'/usr/local/lib/python3.9/lib-dynload',
'/home/usermj/.virtualenvs/python3/lib/python3.9/site-packages']
Server time: Tue, 03 Aug 2021 19:06:36 +0000
Page may have errors, HTTP status=500
Could not find 'Hello'
Did not find a77fee56 in your html
...and later in the protocol (i hope this has nothing to do with the assignment): Did not find anchor tag with 'Answer to the Ultimate Question'
Remark:
I have successfully passed the previous assignment, see https://docs.djangoproject.com/en/3.0/intro/tutorial02/.
You find my actual django files for the polls app (views.py, models.py, urls.py, admin.py) below, hoping it helps to find the error:
views.py:
from django.http import HttpResponse
def index(request):
return HttpResponse("Hello, world bzw. Markus. a77fee56 is the polls index.")
models.py:
from django.db import models
import datetime
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def str(self):
return self.question_text
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def str(self):
return self.choice_text
urls.py:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('owner', views.owner, name='owner'),
path('<int:question_id>/', views.detail, name='detail'),
path('<int:question_id>/results/', views.results, name='results'),
path('<int:question_id>/vote/', views.vote, name='vote'),
]
admin.py:
from django.contrib import admin
from .models import Question
admin.site.register(Question)
--> Thank you