Forums

Auto-grader: Django Tutorial part 3 - Error "[curl] 51: SSL: ...

When sending my solution to the "Auto-grader" for "Django Tutorial part 3" i receive the error

"[curl] 51: SSL: no alternative certificate subject name 'www.username.pythonanywhere.com' [url] https://www.username.pythonanywhere.com/polls/owner"

How can i fix it?

What does it mean 'sending my solution to the "Auto-grader" for "Django Tutorial part 3"'? What do you do exactly?

I just call the url "www.usermj.pythonanywhere.com/polls". In the mentioned course i built an application with name "polls". I have everything that is necessary for it: view.py url.py etc. I followed the instruction from https://docs.djangoproject.com/en/3.0/intro/tutorial03/

Your web app is not at 'www.username.pythonanywhere.com', it's at 'username.pythonanywhere.com'. Make sure you're using the correct address everywhere.

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 AttributeError at /owner 127303 characters of HTML retrieved Show/Hide Retrieved Page Page may have errors, HTTP status=500 Could not find 'Hello' Did not find a77fee56 in your html

and later (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

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

It look like there is no owner view in your views.py