Python Django Tutorial: Full-Featured Web App Part 2 - Applications and Routes
Why Stack Overflow recommends it
Stack Overflow users cite it as the tutorial they were following when their blog app's URL routing, imports or settings broke, and they ask for help with the errors.
Recommended by 0 people across 0 different months, 2019 to 2021.
What it is
Part 2 of Corey Schafer's Django web app series. He creates a blog app inside a Django project, writes simple views, and wires them up with URL patterns using path() and include(). It is a screen-recorded tutorial running about 20 minutes.
What people said
Cites Sihyun Kim · 2019-05 · Stack Overflow · on “How to fix attribute error in Django(Python)?”
I'm newbie to Python and Django. I'm watching [this video] this course and following instructions. But there is and error message keeps coming out like this. AttributeError: module 'blog.views' has no attribute 'post_list' C:\Users\Administrator\PycharmProjects\django_project\blog\urls.py changed, reloading. Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner self.run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run self._targ
Cites Ross Symonds · 2019-10 · Stack Overflow · on “Resolving "GET /blog HTTP/1.1" 404 2065 (Python Django Tutorial: Full-Featured Web App Part 2 - Applications and Routes)”
I am trying to follow this tutorial [this video] on YouTube. I am getting the error message [24/Oct/2019 22:41:41] "GET /blog HTTP/1.1" 404 2065 . urls.py from django.urls import path from .import views urlpatterns = [ path('', views.home, name='blog-home'), ] views.py from django.shortcuts import render from django.http import HttpResponse def home(request): return HttpResposne('<h1>Blog Home</h1>') # Create your views here. urls.py - django_project1 """django_project1 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: [LINK] Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='hom
Cites rudykdaria · 2019-10 · Stack Overflow · on “How to fix problem with DJANGO_SETTINGS_MODULE?”
I am pretty beginner in django and in coding too. Stuck for a while with an error. Will really appreciate if someone's help me!I tried to google it and it gave me a lot of solutions, I tried them but it gave errors too. What should I write to make things done? I took this code from [this video] from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('blog/', include('blog.urls')), ] And it gave me this error: File "urls.py", line 21, in <module> path('admin/', admin.site.urls), File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/utils/functional.py", line 256, in inner self._setup() File "/
Cites equatorial_daydreamer · 2020-01 · Stack Overflow · on “Django not recognising module import/ app folder”
I am following a tutorial [this video] to learn some django. I have followed the tutorial and I get the following error: NameError: name'blog' is not defined when i try to run django_project/urls.py . My code is exactly the same as the tutorial- the source code can be found here [LINK] . My full error is: [LINK] My django_project/urls.py file is as follows: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('', include(blog.urls)),] My directory structure is as follows: [LINK] I am running Python 3.7 with Django 1.11.21 in the same directory as the manage.py file. I also have __init__.py in both the blog and django_project
Cites Bilal Ahmad · 2020-02 · Stack Overflow · on “How to avoid Page 404 Error on my first app”
I am following this tutorial. [this video] Here is my code for views: from django.shortcuts import render from django.http import HttpResponse # Create your views here. def home(request): return HttpResponse('<h1>This is our blog</h1>') def about(request): return HttpResponse('<h1>This is our About Page</h1>') def next(request): return HttpResponse('<h1>This is our next Page</h1>') This is my App urls page code from django.urls import path from . import views urlpatterns = [ path('', views.home, name='blog-home'), path('about/', views.about, name='blog-about'), path('next/', views.next, name='blog-NEXT'), ] This is my main project URL code from django.contrib import admin from django.urls import
Cites Santeau · 2020-12 · Stack Overflow · on “Django set default empty url”
I'm trying to learn Django and I'm following Corey Shafer's tutorials ( [this video] ), but when I try to make two different pages, I get automatically directed to the one with an "empty address": In his: /Blog /urls.py it looks like this: from django.conf.urls import path from . import views urlpatterns = [ path('', views.home, name='blog-home'), path('about/', views.about, name='blog-about'), ] and when he goes to localhost:8000/blog/about, the page displays correctly When I try to imitate his code for blog/urls.py: from django.conf.urls import url from . import views urlpatterns = [ url(r'', views.home, name='blog-home'), url(r'^about/', views.about, name='blog-about'), ] the result of the loc
Cites KawaiiCowboy · 2021-02 · Stack Overflow · on “Error on Django URL : URLconf defined in website.urls, Django tried these URL patterns”
I am running a django project on a ubuntu digital ocean droplet with nginx/gunicorn on my own domain. I am using a virtual environment with Django version 3.1.6 and Python 3.8.5 I am trying to follow Corey Shafers Django tutorial [this video] to create a blog app and while I can reach the generic django success page on example.com I ran into the following from example.com/blog : Page not found (404) Request Method: GET Request URL: example.com/blog Using the URLconf defined in website.urls, Django tried these URL patterns, in this order: admin/ The current path, blog, didn't match any of these. My current ~/projectdir/website/urls.py (see edit at bottom): from django.contrib import admin from dja