0

Why does the python code below crash my website?

But the code at the very bottom does not crash the website

Here is the code that crashes the website:

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

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

Here is the code that does not crash:

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

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

Thank you

orbit6781
  • 1
  • 2

2 Answers2

1

You have a space between url and patterns. It should be all one word urlpatterns.

If you ever need to check the code for any of the other exercises in that book, they're all on github here.

Rob Bricheno
  • 4,467
  • 15
  • 29
  • What else do you think the problem could be? I deleted the space and that did not solve it. The link to the solutions in github have the old url files. In other words they don't have the path() function. – orbit6781 May 27 '18 at 00:01
  • Sorry I don't immediately see something else but I haven't had my coffee yet... Are you able to see debug output in your browser if you configure `DEBUG = True` in your settings.py? That usually helps. – Rob Bricheno May 27 '18 at 07:59
  • Can you look at my edited post? The problem has been pin pointed. I don't know why it happens. – orbit6781 May 27 '18 at 18:08
0

I got to this point in the Crash Course, this area will break your site, temporarily. You will not have made all the files referenced in your code yet. In this case, you haven't made the urls.py file in learning_logs. After this is made, you will not have updated your views.py nor made your index.html template. Keep going, it should be resolved later. See also: https://ehmatthes.github.io/pcc/chapter_18/README.html#updates

Aiatokko
  • 1
  • 1