i ran into a 404 error with the url dispatcher

You need to go to http://mywebsite/page_objects instead of http://mywebsite/WebFetcher/page_objects.

If you want to have the page_objects url nested under WebFetcher then you can do this to your urls.py:

MyProject/urls.py:

urlpatterns = [
    path('WebFetcher/', include('Fetcher.urls')), # add the prefix here
    path('admin/', admin.site.urls),
]

Fetcher/urls.py:

urlpatterns = [
    path('', views.home, name = 'home'),
    path('page_objects/', views.page_objects, name = 'page_objects')
]

Note: your home page will now be at http://mywebsite/WebFetcher – if you want it to be at the root, i.e. http://mywebsite then you can do this instead:

MyProject/urls.py:

urlpatterns = [
    path('WebFetcher/', include('Fetcher.urls')), # add the prefix here
    path('', views.home, name = 'home'), # move the home page path to the root urls.py
    path('admin/', admin.site.urls),
]

Fetcher/urls.py:

urlpatterns = [
    path('page_objects/', views.page_objects, name = 'page_objects')
]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top