title
Python Django Tutorial: Full-Featured Web App Part 2 - Applications and Routes

description
In this Python Django Tutorial, we will be creating a blog application within our Django project. We will also learn how to create URL patterns that are handled by our application views. Let's get started... The code for this series can be found at: https://github.com/CoreyMSchafer/code_snippets/tree/master/Django_Blog ✅ Support My Channel Through Patreon: https://www.patreon.com/coreyms ✅ Become a Channel Member: https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join ✅ One-Time Contribution Through PayPal: https://goo.gl/649HFY ✅ Cryptocurrency Donations: Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3 Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33 Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot ✅ Corey's Public Amazon Wishlist http://a.co/inIyro1 ✅ Equipment I Use and Books I Recommend: https://www.amazon.com/shop/coreyschafer ▶️ You Can Find Me On: My Website - http://coreyms.com/ My Second Channel - https://www.youtube.com/c/coreymschafer Facebook - https://www.facebook.com/CoreyMSchafer Twitter - https://twitter.com/CoreyMSchafer Instagram - https://www.instagram.com/coreymschafer/ #Python #Django

detail
{'title': 'Python Django Tutorial: Full-Featured Web App Part 2 - Applications and Routes', 'heatmap': [{'end': 98.796, 'start': 84.636, 'weight': 0.885}, {'end': 356.966, 'start': 279.897, 'weight': 0.721}, {'end': 543.806, 'start': 515.63, 'weight': 0.917}], 'summary': 'This python django tutorial covers integrating a blog app, setting up url routes, creating a home function, troubleshooting 404 errors, url processing, testing blog routes, and explaining django url routing and view functions.', 'chapters': [{'end': 194.05, 'segs': [{'end': 52.327, 'src': 'embed', 'start': 0.229, 'weight': 0, 'content': [{'end': 1.21, 'text': "Hey there, how's it going everybody?", 'start': 0.229, 'duration': 0.981}, {'end': 9.817, 'text': "In this video we'll be adding a blog application to our Django site and also setting up some URL routes so that we can start directing people to pages that we'd like them to see.", 'start': 1.55, 'duration': 8.267}, {'end': 11.418, 'text': "So let's go ahead and get started.", 'start': 10.157, 'duration': 1.261}, {'end': 14.841, 'text': "So first, let's create a blog app for our site.", 'start': 11.718, 'duration': 3.123}, {'end': 19.544, 'text': "Now a lot of people might get confused at this part and think to yourself well, didn't we already create an app?", 'start': 15.181, 'duration': 4.363}, {'end': 25.189, 'text': "So the thinking behind Django here is that you have your website project, which we've already created.", 'start': 19.945, 'duration': 5.244}, {'end': 29.812, 'text': 'And then within that website, you can have multiple apps that are all their own thing.', 'start': 25.569, 'duration': 4.243}, {'end': 34.835, 'text': 'So for example, we can have a blog section of our website and that will be its own app.', 'start': 30.172, 'duration': 4.663}, {'end': 39.038, 'text': 'And then we could have like a store section of our website and that will be its own app.', 'start': 35.256, 'duration': 3.782}, {'end': 42.24, 'text': 'So a single project can contain multiple apps.', 'start': 39.378, 'duration': 2.862}, {'end': 47.344, 'text': "And we'll see later in the series that this is a good thing for separating out different parts of our project.", 'start': 42.62, 'duration': 4.724}, {'end': 52.327, 'text': 'And another nice thing is that you can take a single app and add it to multiple projects.', 'start': 47.704, 'duration': 4.623}], 'summary': 'Adding a blog app to a django site, setting up url routes, and explaining the concept of multiple apps within a website project.', 'duration': 52.098, 'max_score': 0.229, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk229.jpg'}, {'end': 114.323, 'src': 'heatmap', 'start': 84.636, 'weight': 0.885, 'content': [{'end': 86.719, 'text': 'and we want this name to be blog.', 'start': 84.636, 'duration': 2.083}, {'end': 87.56, 'text': "So I'll run that.", 'start': 86.899, 'duration': 0.661}, {'end': 92.988, 'text': "And once that's run, let me clear the terminal here so that we can see the structure that we just created.", 'start': 87.96, 'duration': 5.028}, {'end': 98.796, 'text': 'Okay, so now let me use that same tree command that I used in the last video to print out our project structure.', 'start': 93.348, 'duration': 5.448}, {'end': 100.577, 'text': "now that we've created that app.", 'start': 99.176, 'duration': 1.401}, {'end': 104.278, 'text': "And again, you might not have this command installed, but don't worry if you don't.", 'start': 100.977, 'duration': 3.301}, {'end': 107.64, 'text': 'I just installed it so that we could see this layout a little bit larger.', 'start': 104.358, 'duration': 3.282}, {'end': 109.101, 'text': 'So I will run tree.', 'start': 107.82, 'duration': 1.281}, {'end': 112.262, 'text': 'And now let me see if we can see this all in one screen here.', 'start': 109.381, 'duration': 2.881}, {'end': 114.323, 'text': 'So yeah, so we can barely fit all that in.', 'start': 112.382, 'duration': 1.941}], 'summary': "Creating a blog named 'blog' with a project structure using the 'tree' command.", 'duration': 29.687, 'max_score': 84.636, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk84636.jpg'}, {'end': 172.24, 'src': 'embed', 'start': 114.643, 'weight': 4, 'content': [{'end': 118.205, 'text': 'Okay, so we already went over the structure of the Django project in the first video.', 'start': 114.643, 'duration': 3.562}, {'end': 122.407, 'text': 'So that was the manage.py file and the Django project directory here.', 'start': 118.505, 'duration': 3.902}, {'end': 124.548, 'text': 'So nothing changed there.', 'start': 123.327, 'duration': 1.221}, {'end': 128.83, 'text': 'But now we have this new blog directory with its own structure.', 'start': 124.888, 'duration': 3.942}, {'end': 132.471, 'text': 'And that blog directory is what that start app command created.', 'start': 129.169, 'duration': 3.302}, {'end': 136.253, 'text': 'Now, this is what can intimidate some people about getting started with Django,', 'start': 132.831, 'duration': 3.422}, {'end': 144.396, 'text': "because we really haven't done any coding yet and there are already so many different files that have been created from the start project and the start app commands.", 'start': 136.253, 'duration': 8.143}, {'end': 149.84, 'text': 'So if anyone has watched my Flask series, then this might be intimidating compared to a framework like that,', 'start': 144.776, 'duration': 5.064}, {'end': 154.585, 'text': "because we have so many more files that we're starting out with before we even start doing any coding.", 'start': 149.84, 'duration': 4.745}, {'end': 157.947, 'text': 'But even though those commands created a lot of these files,', 'start': 154.945, 'duration': 3.002}, {'end': 162.391, 'text': "we're going to get so much more out of the box than what we got with a smaller framework like Flask.", 'start': 157.947, 'duration': 4.444}, {'end': 164.173, 'text': "So there's definitely a trade-off there.", 'start': 162.692, 'duration': 1.481}, {'end': 167.856, 'text': 'So, instead of going over all of these right now,', 'start': 164.633, 'duration': 3.223}, {'end': 172.24, 'text': "let's just go ahead and get a view created so that we can actually write some code and see some progress.", 'start': 167.856, 'duration': 4.384}], 'summary': 'Introduction to django project structure and trade-offs with smaller frameworks like flask.', 'duration': 57.597, 'max_score': 114.643, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk114643.jpg'}], 'start': 0.229, 'title': 'Integrating a blog app and django project structure', 'summary': 'Covers adding a blog application to a django site, setting up url routes, and explaining the concept of multiple apps within a single project. it also discusses the structure of a django project, emphasizing the creation of multiple files and directories and the comparison with flask.', 'chapters': [{'end': 114.323, 'start': 0.229, 'title': 'Adding blog app to django site', 'summary': 'Covers adding a blog application to a django site, setting up url routes, and explaining the concept of multiple apps within a single project, highlighted by the process of creating a blog app and its potential benefits.', 'duration': 114.094, 'highlights': ['The process of creating a blog app within a Django project is demonstrated, emphasizing the concept of having multiple apps within a single project and the ability to use a single app across multiple projects.', 'The explanation of how Django allows for the creation of multiple apps within a single project, providing the example of having a blog section and a store section as separate apps within a website.', 'The demonstration of setting up URL routes to direct users to specific pages within the blog application, illustrating the practical implementation of the added functionality to the Django site.', 'The introduction of the concept of having a website project containing multiple apps, such as a blog section and a store section, to segregate different parts of the project for better organization and management.']}, {'end': 194.05, 'start': 114.643, 'title': 'Django project structure', 'summary': 'Discusses the structure of a django project, emphasizing the creation of multiple files and directories, the comparison with flask, and the upcoming focus on creating a view.', 'duration': 79.407, 'highlights': ['The chapter discusses the structure of a Django project, emphasizing the creation of multiple files and directories.', 'The transcript highlights the comparison between Django and Flask, mentioning the intimidating number of files created in Django compared to Flask.', 'The focus is on creating a view to start writing code and seeing progress.']}], 'duration': 193.821, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk229.jpg', 'highlights': ['The process of creating a blog app within a Django project is demonstrated, emphasizing the concept of having multiple apps within a single project and the ability to use a single app across multiple projects.', 'The explanation of how Django allows for the creation of multiple apps within a single project, providing the example of having a blog section and a store section as separate apps within a website.', 'The demonstration of setting up URL routes to direct users to specific pages within the blog application, illustrating the practical implementation of the added functionality to the Django site.', 'The introduction of the concept of having a website project containing multiple apps, such as a blog section and a store section, to segregate different parts of the project for better organization and management.', 'The chapter discusses the structure of a Django project, emphasizing the creation of multiple files and directories.', 'The transcript highlights the comparison between Django and Flask, mentioning the intimidating number of files created in Django compared to Flask.', 'The focus is on creating a view to start writing code and seeing progress.']}, {'end': 598.597, 'segs': [{'end': 266.131, 'src': 'embed', 'start': 239.754, 'weight': 0, 'content': [{'end': 243.617, 'text': 'So this is where the logic goes for how we want to handle certain routes.', 'start': 239.754, 'duration': 3.863}, {'end': 247.079, 'text': "So I'll create this function and that is called home.", 'start': 244.017, 'duration': 3.062}, {'end': 253.224, 'text': "And like I said, this takes a request argument that we're not going to use right now, but it has to be there.", 'start': 247.64, 'duration': 5.584}, {'end': 259.689, 'text': "So for now, we're simply going to return an HTTP response that says that we've landed on the blog homepage.", 'start': 253.684, 'duration': 6.005}, {'end': 266.131, 'text': 'So I will return an HTTP response and I will just make this an H1 tag.', 'start': 259.988, 'duration': 6.143}], 'summary': "Creating a function 'home' to handle routes, returning an http response for blog homepage.", 'duration': 26.377, 'max_score': 239.754, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk239754.jpg'}, {'end': 356.966, 'src': 'heatmap', 'start': 279.897, 'weight': 0.721, 'content': [{'end': 284.078, 'text': "but we haven't actually mapped our URL pattern to this view function just yet.", 'start': 279.897, 'duration': 4.181}, {'end': 290.182, 'text': "So to do this, we're going to create a new bot module in our blog directory called urls.py.", 'start': 284.498, 'duration': 5.684}, {'end': 295.488, 'text': "And then that file is where we'll map the URLs that we want to correspond to each view function.", 'start': 290.542, 'duration': 4.946}, {'end': 296.95, 'text': "So let's do that now.", 'start': 295.848, 'duration': 1.102}, {'end': 306.12, 'text': "So within our blog app directory, I'm going to create a new file and I'm going to call this urls.py.", 'start': 297.43, 'duration': 8.69}, {'end': 311.846, 'text': 'Now this URLs module is going to be very similar to the URLs module that we saw in our Django project.', 'start': 306.481, 'duration': 5.365}, {'end': 319.45, 'text': 'So if I open up the project level URLs PI file, then we can see that they have imported this path here.', 'start': 312.166, 'duration': 7.284}, {'end': 324.534, 'text': 'And then they have a list of URL patterns that are using those paths.', 'start': 319.831, 'duration': 4.703}, {'end': 326.795, 'text': "And we're going to do something very similar.", 'start': 324.914, 'duration': 1.881}, {'end': 332.558, 'text': "So I'm going to copy this import of the path from Django URLs.", 'start': 326.935, 'duration': 5.623}, {'end': 336.421, 'text': "And I'm going to paste this into our blog URLs module.", 'start': 332.879, 'duration': 3.542}, {'end': 339.765, 'text': "And I'm also going to copy those URL patterns.", 'start': 336.841, 'duration': 2.924}, {'end': 344.691, 'text': 'So I will copy that and paste that into our blogurls.py file as well.', 'start': 339.885, 'duration': 4.806}, {'end': 349.898, 'text': "Now we're also going to be using this home view function here within our URLs.", 'start': 345.011, 'duration': 4.887}, {'end': 356.966, 'text': "So what we're going to do is import this views.py module within our URLs.", 'start': 350.739, 'duration': 6.227}], 'summary': 'Creating a new urls.py module to map urls to view functions in the blog app.', 'duration': 77.069, 'max_score': 279.897, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk279897.jpg'}, {'end': 311.846, 'src': 'embed', 'start': 284.498, 'weight': 2, 'content': [{'end': 290.182, 'text': "So to do this, we're going to create a new bot module in our blog directory called urls.py.", 'start': 284.498, 'duration': 5.684}, {'end': 295.488, 'text': "And then that file is where we'll map the URLs that we want to correspond to each view function.", 'start': 290.542, 'duration': 4.946}, {'end': 296.95, 'text': "So let's do that now.", 'start': 295.848, 'duration': 1.102}, {'end': 306.12, 'text': "So within our blog app directory, I'm going to create a new file and I'm going to call this urls.py.", 'start': 297.43, 'duration': 8.69}, {'end': 311.846, 'text': 'Now this URLs module is going to be very similar to the URLs module that we saw in our Django project.', 'start': 306.481, 'duration': 5.365}], 'summary': 'Creating a new bot module in the blog directory to map urls to view functions.', 'duration': 27.348, 'max_score': 284.498, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk284498.jpg'}, {'end': 452.864, 'src': 'embed', 'start': 423.648, 'weight': 3, 'content': [{'end': 428.492, 'text': 'So if I had a store app, then maybe they have an app that has a home route also.', 'start': 423.648, 'duration': 4.844}, {'end': 431.935, 'text': "So I'd want to be clear with the actual naming of this path.", 'start': 428.873, 'duration': 3.062}, {'end': 438.341, 'text': 'Okay, so now we have the URL path for our blog homepage mapped to our home function in the views file.', 'start': 432.276, 'duration': 6.065}, {'end': 440.841, 'text': "But this still wouldn't work quite yet.", 'start': 438.781, 'duration': 2.06}, {'end': 445.823, 'text': 'Because if you remember, we have a URLs module in our main project directory also.', 'start': 441.222, 'duration': 4.601}, {'end': 452.864, 'text': 'And that URLs module will tell our whole website which URLs should send us to our blog app.', 'start': 446.343, 'duration': 6.521}], 'summary': 'Discussing url path mapping for a store app and blog homepage in a project directory.', 'duration': 29.216, 'max_score': 423.648, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk423648.jpg'}, {'end': 501.522, 'src': 'embed', 'start': 471.129, 'weight': 4, 'content': [{'end': 475.411, 'text': "But instead, we're going to tell Django which route should get mapped to our blog URLs.", 'start': 471.129, 'duration': 4.282}, {'end': 480.953, 'text': "So we're just going to need to import another function from Django URLs.", 'start': 475.811, 'duration': 5.142}, {'end': 483.154, 'text': 'And that is going to be the include function.', 'start': 481.233, 'duration': 1.921}, {'end': 488.116, 'text': 'So up here from Django URLs, we also want to import include.', 'start': 483.294, 'duration': 4.822}, {'end': 491.017, 'text': 'And now we can add to our list of URL patterns.', 'start': 488.556, 'duration': 2.461}, {'end': 494.358, 'text': 'to specify which route should go to our blog URLs.', 'start': 491.317, 'duration': 3.041}, {'end': 501.522, 'text': 'So I will add onto this and I will, let me just copy this path here and paste this in.', 'start': 494.699, 'duration': 6.823}], 'summary': 'Using django urls to map blog route, import include function.', 'duration': 30.393, 'max_score': 471.129, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk471129.jpg'}, {'end': 560.194, 'src': 'heatmap', 'start': 515.63, 'weight': 5, 'content': [{'end': 518.111, 'text': 'And this is going to be blog.urls.', 'start': 515.63, 'duration': 2.481}, {'end': 527.157, 'text': 'Okay, so now when we open our web page in the browser and go to forward slash blog, then it will map that to our blog URLs.', 'start': 518.471, 'duration': 8.686}, {'end': 535.262, 'text': 'And then within our blog URLs, we have that empty path that maps onto our home view.', 'start': 527.678, 'duration': 7.584}, {'end': 539.384, 'text': "And we'll be sure to walk through this a couple of times just to be sure that you're getting all of this correctly.", 'start': 535.562, 'duration': 3.822}, {'end': 543.806, 'text': "Now on one other side note here if you've watched any Django tutorials before,", 'start': 539.704, 'duration': 4.102}, {'end': 547.408, 'text': 'then you might have seen people who use regular expressions to match their paths.', 'start': 543.806, 'duration': 3.602}, {'end': 550.249, 'text': 'And that used to be how we would used to do this.', 'start': 547.868, 'duration': 2.381}, {'end': 553.671, 'text': "But this isn't required anymore in later versions of Django.", 'start': 550.589, 'duration': 3.082}, {'end': 560.194, 'text': 'And regular expressions can be overly complicated, especially when our routes are usually going to be pretty simple.', 'start': 554.111, 'duration': 6.083}], 'summary': 'Configuring blog urls in django without regular expressions.', 'duration': 41.723, 'max_score': 515.63, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk515630.jpg'}], 'start': 194.35, 'title': 'Creating a home function and url mapping in django', 'summary': 'Explains creating a home function in django, including importing render and http response, and creating url mapping by adding a new bot module in the blog directory, specifying routes, and avoiding regular expressions for route matching.', 'chapters': [{'end': 284.078, 'start': 194.35, 'title': 'Creating a home function in django', 'summary': "Explains the process of creating a home function in django, including importing render and http response, creating the home function to handle traffic from the blog homepage, and returning an http response displaying 'blog home'.", 'duration': 89.728, 'highlights': ["The chapter explains the process of creating a home function in Django, including importing render and HTTP response, creating the home function to handle traffic from the blog homepage, and returning an HTTP response displaying 'blog home'.", "The function 'home' is created to handle the traffic from the homepage of the blog, taking in a request argument and returning an HTTP response displaying 'blog home'.", "The function 'home' is created to handle the traffic from the homepage of the blog, taking in a request argument and returning an HTTP response displaying 'blog home'."]}, {'end': 598.597, 'start': 284.498, 'title': 'Creating url mapping in django', 'summary': 'Explains the process of creating a new bot module in the blog directory called urls.py, mapping urls to view functions, and using the include function to specify which route should go to the blog urls, ensuring that the blog homepage is correctly mapped and explaining the avoidance of regular expressions for route matching in django.', 'duration': 314.099, 'highlights': ['The chapter explains the process of creating a new bot module in the blog directory called urls.py. Creation of new bot module, file naming as urls.py', 'The chapter explains the process of mapping URLs to view functions. Mapping of URLs to view functions', 'The chapter explains the usage of the include function to specify which route should go to the blog URLs. Usage of include function for route specification', 'The chapter ensures that the blog homepage is correctly mapped. Verification of correct mapping of the blog homepage', 'The chapter explains the avoidance of regular expressions for route matching in Django. Explanation on avoiding regular expressions for route matching']}], 'duration': 404.247, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk194350.jpg', 'highlights': ["The chapter explains the process of creating a home function in Django, including importing render and HTTP response, creating the home function to handle traffic from the blog homepage, and returning an HTTP response displaying 'blog home'.", "The function 'home' is created to handle the traffic from the homepage of the blog, taking in a request argument and returning an HTTP response displaying 'blog home'.", 'The chapter explains the process of creating a new bot module in the blog directory called urls.py. Creation of new bot module, file naming as urls.py', 'The chapter explains the process of mapping URLs to view functions. Mapping of URLs to view functions', 'The chapter explains the usage of the include function to specify which route should go to the blog URLs. Usage of include function for route specification', 'The chapter ensures that the blog homepage is correctly mapped. Verification of correct mapping of the blog homepage', 'The chapter explains the avoidance of regular expressions for route matching in Django. Explanation on avoiding regular expressions for route matching']}, {'end': 732.499, 'segs': [{'end': 626.114, 'src': 'embed', 'start': 598.597, 'weight': 0, 'content': [{'end': 603.721, 'text': 'So first of all, if we go back to the root of our website, then we can see that now we get a 404 page not found error.', 'start': 598.597, 'duration': 5.124}, {'end': 612.486, 'text': 'So once we add some URL patterns, then it should no longer display the default development site like it did before.', 'start': 605.462, 'duration': 7.024}, {'end': 616.509, 'text': "So now it's just going to try to match our specific routes.", 'start': 613.267, 'duration': 3.242}, {'end': 618.93, 'text': 'So in this case, we get a 404.', 'start': 616.929, 'duration': 2.001}, {'end': 626.114, 'text': 'And if we look at the debug output down here, then we can see that within our terminal and that dev server,', 'start': 618.93, 'duration': 7.184}], 'summary': 'Adding url patterns resolves 404 error, enabling specific route matching.', 'duration': 27.517, 'max_score': 598.597, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk598597.jpg'}, {'end': 688.385, 'src': 'embed', 'start': 638.559, 'weight': 1, 'content': [{'end': 646.521, 'text': 'but this is showing us all of the url patterns that it tried to match, and it says that it tried to match against these url patterns in this order.', 'start': 638.559, 'duration': 7.962}, {'end': 654.503, 'text': "so first there is admin and then there is blog, and since it didn't match either of those, then it returned a 404 page not found.", 'start': 646.521, 'duration': 7.982}, {'end': 663.448, 'text': 'so now, if we navigate to forward, slash blog and run that, then now we can see that we got the text of blog home.', 'start': 654.503, 'duration': 8.945}, {'end': 670.554, 'text': 'And in Chrome, we can view the source of an HTML by right clicking and then going to view page source.', 'start': 663.888, 'duration': 6.666}, {'end': 675.798, 'text': 'And if I do that, then we can see exactly what we returned to this route here.', 'start': 671.034, 'duration': 4.764}, {'end': 680.162, 'text': 'And we can see that this is blog home text wrapped in h1 tags.', 'start': 676.159, 'duration': 4.003}, {'end': 681.003, 'text': 'So that worked.', 'start': 680.182, 'duration': 0.821}, {'end': 688.385, 'text': "So now let's walk through this one more time so that we can see exactly what order all of this goes through.", 'start': 682.504, 'duration': 5.881}], 'summary': "The system attempted to match url patterns in a specific order, resulting in a 404 error, but accessing '/blog' displayed the expected content.", 'duration': 49.826, 'max_score': 638.559, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk638559.jpg'}], 'start': 598.597, 'title': 'Troubleshooting 404 errors and route matching', 'summary': 'Details the process of troubleshooting and resolving 404 errors by adding url patterns and examining debug output, showcasing the order in which url patterns are matched and the successful rendering of specific routes.', 'chapters': [{'end': 732.499, 'start': 598.597, 'title': 'Troubleshooting 404 errors and route matching', 'summary': 'Details the process of troubleshooting and resolving 404 errors by adding url patterns and examining debug output, showcasing the order in which url patterns are matched and the successful rendering of specific routes.', 'duration': 133.902, 'highlights': ['The process of troubleshooting and resolving 404 errors by adding URL patterns and examining debug output is explained. Examination of debug output to identify the routes that were accessed and the corresponding status codes, showcasing the process of resolving 404 errors by adding URL patterns.', 'The order in which URL patterns are matched is demonstrated, with the system attempting to match against specified URL patterns and indicating the order of matching attempts. Demonstration of the order in which URL patterns are matched, showcasing the process where the system attempts to match against specified URL patterns and indicates the sequence of matching attempts.', "The successful rendering of specific routes is illustrated, with the system displaying the returned content for a specific route, such as the 'blog home' text wrapped in h1 tags. Illustration of the successful rendering of specific routes, displaying the returned content for a particular route, exemplified by the 'blog home' text wrapped in h1 tags."]}], 'duration': 133.902, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk598597.jpg', 'highlights': ['The process of troubleshooting and resolving 404 errors by adding URL patterns and examining debug output is explained.', 'The order in which URL patterns are matched is demonstrated, with the system attempting to match against specified URL patterns and indicating the order of matching attempts.', "The successful rendering of specific routes is illustrated, with the system displaying the returned content for a specific route, such as the 'blog home' text wrapped in h1 tags."]}, {'end': 951.984, 'segs': [{'end': 823.869, 'src': 'embed', 'start': 775.614, 'weight': 1, 'content': [{'end': 779.999, 'text': 'And we do have a pattern that matches an empty route and that pattern will be handled.', 'start': 775.614, 'duration': 4.385}, {'end': 783.501, 'text': 'by the function views.home.', 'start': 780.359, 'duration': 3.142}, {'end': 787.404, 'text': 'So then we can navigate to our views file and view that home function.', 'start': 783.781, 'duration': 3.623}, {'end': 797.53, 'text': 'And now it comes into that home function and it simply says, okay, so now we just want to return an HTTP response with an H1 tag that says blog home.', 'start': 787.704, 'duration': 9.826}, {'end': 800.092, 'text': 'So that is a walkthrough of the whole process.', 'start': 797.97, 'duration': 2.122}, {'end': 806.796, 'text': "So now let's add another route to our blog so that we can get a feel for this whole process here.", 'start': 800.652, 'duration': 6.144}, {'end': 809.478, 'text': "So now let's add an about page for the blog.", 'start': 807.136, 'duration': 2.342}, {'end': 813.381, 'text': "And we'll do this in the same order that we added the home page.", 'start': 809.918, 'duration': 3.463}, {'end': 819.065, 'text': "So first, within our views, we'll add a function that handles the logic for the about page.", 'start': 813.721, 'duration': 5.344}, {'end': 821.307, 'text': 'And I will just call this about.', 'start': 819.485, 'duration': 1.822}, {'end': 823.869, 'text': "So I'll say def about.", 'start': 821.487, 'duration': 2.382}], 'summary': 'The transcript covers adding routes for a blog, such as the home and about pages, and handling them in the views file.', 'duration': 48.255, 'max_score': 775.614, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk775614.jpg'}, {'end': 951.984, 'src': 'embed', 'start': 869.895, 'weight': 0, 'content': [{'end': 872.636, 'text': 'Okay And at this point we should be done with that route.', 'start': 869.895, 'duration': 2.741}, {'end': 877.218, 'text': 'So you might be wondering if we need to add anything to our project URLs module.', 'start': 872.976, 'duration': 4.242}, {'end': 881.06, 'text': "But we don't need to add anything to those URL patterns,", 'start': 877.578, 'duration': 3.482}, {'end': 887.765, 'text': 'because that just simply tells our website that when someone goes to the blog route to send them to our blog URLs.', 'start': 881.06, 'duration': 6.705}, {'end': 891.548, 'text': 'And then our blog URLs will handle this home and about route from there.', 'start': 888.105, 'duration': 3.443}, {'end': 895.43, 'text': "So let's open this up in our browser and make sure that that worked.", 'start': 891.968, 'duration': 3.462}, {'end': 899.853, 'text': 'So now if I go to our blog route, then our blog homepage still works.', 'start': 895.85, 'duration': 4.003}, {'end': 905.497, 'text': 'Now if I go to blog forward slash about, then we can see that now we have an about page that is working.', 'start': 900.213, 'duration': 5.284}, {'end': 911.499, 'text': "and now let's walk through this one more time, now that we've added this about route, so that we're sure that we understand this whole process.", 'start': 905.777, 'duration': 5.722}, {'end': 915.641, 'text': "so we've navigated to forward slash, blog, forward slash about.", 'start': 911.499, 'duration': 4.142}, {'end': 920.643, 'text': "so first it's going to check the url patterns and our projects urls module.", 'start': 915.641, 'duration': 5.002}, {'end': 929.948, 'text': 'so i will open up our projects urls module and now our application is saying okay, somebody has navigated to forward slash, blog, forward slash about.', 'start': 920.643, 'duration': 9.305}, {'end': 937.435, 'text': 'Do I have any patterns that match this? And yes, I have one pattern that matches the forward slash blog part.', 'start': 930.268, 'duration': 7.167}, {'end': 942.839, 'text': "So I'm going to send this to blog.urls for further processing.", 'start': 937.835, 'duration': 5.004}, {'end': 947.323, 'text': 'And remember when it passes this to the blog URLs for further processing.', 'start': 943.279, 'duration': 4.044}, {'end': 951.984, 'text': "it's going to chop off the part that it's already matched and only send the remaining string.", 'start': 947.703, 'duration': 4.281}], 'summary': 'Added about route to blog, verified functionality, and explained routing process.', 'duration': 82.089, 'max_score': 869.895, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk869895.jpg'}], 'start': 732.979, 'title': 'Url processing and testing blog routes in web development', 'summary': 'Covers url processing and routing in web development, including handling empty routes, adding new routes, setting up view functions, and the project urls module. it also demonstrates testing blog routes in a browser to ensure the functionality of the blog homepage and about page through pattern matching and processing.', 'chapters': [{'end': 891.548, 'start': 732.979, 'title': 'Url processing and routing in web development', 'summary': 'Explains the process of url processing and routing in web development, covering the handling of empty routes, adding new routes, setting up view functions, and the project urls module.', 'duration': 158.569, 'highlights': ['URL Processing and Routing', 'The process of URL processing and routing in web development is explained, covering the handling of empty routes, adding new routes, setting up view functions, and the project URLs module.', 'The function views.home handles the pattern for an empty route, leading to the navigation to the views file and the execution of the home function, which returns an HTTP response with an H1 tag stating blog home.', 'The addition of a new route for the about page is detailed, including the creation of a function for the about page, defining the path and view function in the blog URLs module, and the completion of the route without needing to modify the project URLs module.']}, {'end': 951.984, 'start': 891.968, 'title': 'Testing blog routes in browser', 'summary': 'Demonstrates the process of testing blog routes in a browser, ensuring functionality of the blog homepage and about page by navigating to the respective routes and understanding the pattern matching and processing involved.', 'duration': 60.016, 'highlights': ['The process involves testing the functionality of the blog homepage and about page by navigating to the respective routes in the browser.', 'The application checks the URL patterns in the projects URLs module to find matches for the requested route, indicating a clear understanding of the pattern matching process.', 'When a match is found, it passes the request to the blog URLs for further processing, demonstrating the sequential processing involved in handling the routes.']}], 'duration': 219.005, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk732979.jpg', 'highlights': ['The process of URL processing and routing in web development is explained, covering the handling of empty routes, adding new routes, setting up view functions, and the project URLs module.', 'The function views.home handles the pattern for an empty route, leading to the navigation to the views file and the execution of the home function, which returns an HTTP response with an H1 tag stating blog home.', 'The addition of a new route for the about page is detailed, including the creation of a function for the about page, defining the path and view function in the blog URLs module, and the completion of the route without needing to modify the project URLs module.', 'The process involves testing the functionality of the blog homepage and about page by navigating to the respective routes in the browser.', 'The application checks the URL patterns in the projects URLs module to find matches for the requested route, indicating a clear understanding of the pattern matching process.', 'When a match is found, it passes the request to the blog URLs for further processing, demonstrating the sequential processing involved in handling the routes.']}, {'end': 1214.399, 'segs': [{'end': 1014.308, 'src': 'embed', 'start': 952.324, 'weight': 0, 'content': [{'end': 959.527, 'text': "So in this case, it chops off the blog part of the URL and passes the about string that's left to the blog URLs.", 'start': 952.324, 'duration': 7.203}, {'end': 965.268, 'text': "So within blog URLs, now it's saying, okay, now I'm looking for a route that matches about.", 'start': 959.927, 'duration': 5.341}, {'end': 969.011, 'text': 'Do I have anything that matches about? and I do here.', 'start': 965.368, 'duration': 3.643}, {'end': 973.856, 'text': "So what view function handles this? And it's this views.about function.", 'start': 969.431, 'duration': 4.425}, {'end': 982.046, 'text': "So then if we go into views, then we can see that we're returning an HTTP response with this h1 tag with the text blog about.", 'start': 974.177, 'duration': 7.869}, {'end': 985.108, 'text': "Okay, so hopefully that makes sense after we've walked through it a couple of times.", 'start': 982.466, 'duration': 2.642}, {'end': 991.952, 'text': "Now that might seem overly complicated to jump around that much, but it's actually a good thing that the URL gets passed around like this,", 'start': 985.408, 'duration': 6.544}, {'end': 1000.978, 'text': 'because if we wanted to change the route to our blog application, then we can simply change that in one place, and it applies to all of those routes.', 'start': 991.952, 'duration': 9.026}, {'end': 1004.641, 'text': "So for example, let's say that we had a blog that was in development.", 'start': 1001.339, 'duration': 3.302}, {'end': 1010.265, 'text': "And we wanted to do some live testing on our website, but weren't ready to quite make it live yet.", 'start': 1005.061, 'duration': 5.204}, {'end': 1014.308, 'text': "So we could simply go to our project's URLs file.", 'start': 1010.645, 'duration': 3.663}], 'summary': 'The transcript explains how the url routing in a blog application allows for easy changes and applies to all routes.', 'duration': 61.984, 'max_score': 952.324, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk952324.jpg'}, {'end': 1095.62, 'src': 'embed', 'start': 1072.423, 'weight': 3, 'content': [{'end': 1080.168, 'text': 'So for example, at the end of admin, we have a forward slash here and after blog dev, I put a trailing forward slash there as well.', 'start': 1072.423, 'duration': 7.745}, {'end': 1083.43, 'text': 'So why did I do that and can we leave it off??', 'start': 1080.909, 'duration': 2.521}, {'end': 1088.514, 'text': "Well, I think it's a good idea to leave it there, because, by default, if it has a trailing slash,", 'start': 1083.791, 'duration': 4.723}, {'end': 1095.62, 'text': 'then Django will redirect routes without a forward slash or without a trailing slash to that route that has one.', 'start': 1088.514, 'duration': 7.106}], 'summary': "Including a trailing slash in routes can optimize django's redirection process.", 'duration': 23.197, 'max_score': 1072.423, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk1072423.jpg'}, {'end': 1147.521, 'src': 'embed', 'start': 1115.18, 'weight': 2, 'content': [{'end': 1120.203, 'text': 'So right now we have to go to blog underscore dev to get to the homepage of our blog.', 'start': 1115.18, 'duration': 5.023}, {'end': 1124.685, 'text': 'But what if we just wanted to be able to go to the homepage of our website?', 'start': 1120.543, 'duration': 4.142}, {'end': 1130.108, 'text': 'So just localhost port 8000 is what it is right now, and see the homepage of our blog from there.', 'start': 1124.745, 'duration': 5.363}, {'end': 1137.132, 'text': 'So in order to do that within our project URLs, we can just simply leave the path to our blog URLs empty.', 'start': 1130.408, 'duration': 6.724}, {'end': 1139.173, 'text': 'So I will get rid of that and save it.', 'start': 1137.332, 'duration': 1.841}, {'end': 1147.521, 'text': 'And by doing that, it will match the empty path in our project URLs And also the empty path and our blog URLs and just return the blog homepage.', 'start': 1139.533, 'duration': 7.988}], 'summary': 'To access the website homepage, leave the blog urls path empty, which will then match the empty path in the project urls and return the blog homepage.', 'duration': 32.341, 'max_score': 1115.18, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk1115180.jpg'}], 'start': 952.324, 'title': 'Django url routing and view functions', 'summary': 'Covers url routing and view functions, demonstrating the process and matching of urls, and explains basic routing in django, including changing routes, trailing slashes in url patterns, and setting the blog as the homepage.', 'chapters': [{'end': 991.952, 'start': 952.324, 'title': 'Url routing and view functions', 'summary': 'Explains the process of url routing and view functions, demonstrating how the url is passed and matched to the corresponding view function while returning an http response with specific content.', 'duration': 39.628, 'highlights': ['The URL is chopped off to pass the remaining string to the blog URLs, which is then matched to a route, resulting in the execution of a specific view function and returning an HTTP response with specific content.', 'The process of URL routing and view functions is explained, showcasing the passing and matching of URLs to corresponding view functions, ultimately leading to the generation of an HTTP response with specific content.']}, {'end': 1214.399, 'start': 991.952, 'title': 'Django basic routing', 'summary': 'Explains how to change route in django in one place, making it applicable to all routes, the importance of trailing slashes in url patterns, and setting the blog as the homepage of the entire website, providing a comprehensive understanding of basic routing in django.', 'duration': 222.447, 'highlights': ['Changing route in one place applies to all routes, simplifying management and testing of website, enhancing efficiency and reducing errors.', 'Importance of trailing slashes in URL patterns, as Django redirects routes without a trailing slash to the one with a trailing slash by default, ensuring consistent results and avoiding confusion for website users.', 'Setting the blog as the homepage of the entire website by leaving the path to blog URLs empty in the project URLs, allowing easy access to the blog from the root of the website, improving user experience and website structure.']}], 'duration': 262.075, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/a48xeeo5Vnk/pics/a48xeeo5Vnk952324.jpg', 'highlights': ['The process of URL routing and view functions is explained, showcasing the passing and matching of URLs to corresponding view functions, ultimately leading to the generation of an HTTP response with specific content.', 'The URL is chopped off to pass the remaining string to the blog URLs, which is then matched to a route, resulting in the execution of a specific view function and returning an HTTP response with specific content.', 'Setting the blog as the homepage of the entire website by leaving the path to blog URLs empty in the project URLs, allowing easy access to the blog from the root of the website, improving user experience and website structure.', 'Importance of trailing slashes in URL patterns, as Django redirects routes without a trailing slash to the one with a trailing slash by default, ensuring consistent results and avoiding confusion for website users.', 'Changing route in one place applies to all routes, simplifying management and testing of website, enhancing efficiency and reducing errors.']}], 'highlights': ['The process of creating a blog app within a Django project is demonstrated, emphasizing the concept of having multiple apps within a single project and the ability to use a single app across multiple projects.', 'The explanation of how Django allows for the creation of multiple apps within a single project, providing the example of having a blog section and a store section as separate apps within a website.', 'The demonstration of setting up URL routes to direct users to specific pages within the blog application, illustrating the practical implementation of the added functionality to the Django site.', 'The introduction of the concept of having a website project containing multiple apps, such as a blog section and a store section, to segregate different parts of the project for better organization and management.', 'The process of troubleshooting and resolving 404 errors by adding URL patterns and examining debug output is explained.', 'The process of URL processing and routing in web development is explained, covering the handling of empty routes, adding new routes, setting up view functions, and the project URLs module.', 'The process of URL routing and view functions is explained, showcasing the passing and matching of URLs to corresponding view functions, ultimately leading to the generation of an HTTP response with specific content.']}