There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
I think in step 4 of this exercise the hint forgets the include() function in the URLconf, or possibly I was just supposed to know to add it.
Original hint that did not work:
Include the vetoffice URLconf by adding path('', 'vetoffice.urls') to the urlpatterns in djangovet/djangovet/urls.py
Change to make the solution work:
Include the vetoffice URLconf by adding path('', *INCLUDE*('vetoffice.urls')) to the urlpatterns in djangovet/djangovet/urls.py .
This module wasn’t very straight forward. When I got to the last question it wasn’t clear what the difference between the two urls.py files was. I get the first but didn’t conceptually grasp how the parent urls.py file connects to the main.html. I understand now, with the ‘include’ designation that we are essentially connecting the two.
Was having issues seeing the change upon running the server. I couldn’t find the admin or the home page and nothing loaded even after the successful completion of the exercise.
update: needed to add 0.0.0.0:4001 to the end of the ‘runserver’ command. Works now. Really want to understand these elements better.
When I go to http://localhost:4001/home I am still greeted with the welcome text. What’s the point of route parameter in vetoffice urls.py file?
Edit: Ok, I guess we have to do it twice because we want ‘apps’ to be independent so that we could import vetoffice to another project but still question remains - why route parameter is ‘ignored’ in vetoffice urls.py?
I got to the end of this lesson and tried to run the server with python3 manage.py runserver 0.0.0.0:4001. However I am getting what seems to be a database error:
return Database.Cursor.execute(self, query)
django.db.utils.DatabaseError: database disk image is malformed
Did i do something wrong in my code? I followed the steps correctly in the lesson. Here is my urls.py in my vetoffice directory:
from django.urls import path
from . import views
urlpatterns = [
path('',views.home),
]
and then here is my urls.py in the main djangovet directory:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('vetoffice.urls'))
]
Am I doing something wrong? Any help is much appreciated! Thanks in advance! Happy coding