Saturday, May 30, 2020

Why is "Hello World!" alternating with Django welcome page after following tutorial?

I just followed this tutorial to create the simplest possible Django application:


I used campaign instead of tutorial and app instead of hello_world because I intend to transform the tutorial into a simple production application.

When I load the app in my browser, I get either "Hello, World!" (the expected result) or the Django welcome page ("The install worked successfully! Congratulations! You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs"). The two alternate. It's not random -- I always get one and then the other when I reload the page.

campaign/app/urls.py contains:

from django.urls import path
from . import views

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

campaign/campaign/urls.py contains:

from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('', include('app.urls')),
    path('admin/', admin.site.urls),
]

I don't get how it works as expected every OTHER time. Obviously I can't move on until I get this fixed.








--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/51f3e62a-62c0-4db4-a8d0-2f96a6af3cf7%40googlegroups.com.

No comments:

Post a Comment