When converting from Django 1.11 to Django 2, how do you configure the URLs for Include()


Great tutorials.  Thank you for your efforts putting this together.

 

I completed the Django 1.0 series and started reviewing the Django 2.0 tutorials.  I performed a pip install -u django to upgrade the work I had done in the previous tutorial to 2.1.

After the upgrade, I ran >python -Wa manage.py test and needed to correct a few things.  The Category item in the Blog app needed to have the foreign key include an argument for on_delete.  I managed to figure that much out.

I also have an error that there is a problem with the include in the URL.py at the project level.  I replaced the imports of URL with Path and figured out how to correct the home and admin url patterns using path instead of url.

 

I am stuck on how to correct the URL pattern to replace the include pointing to the blog/ app_name= blog section, and what is needed in the blog/url.py to adapt those urls to Django 2.0. 

Any suggestions?

Many thanks,

 

Chris

Category: Django
Asked at Aug. 16, 2018, 5:24 p.m. by wood24

1 Answer


Chris, Ok so the new requirement is that we include app_name = "directory_name" so if I remember correctly we called it "blog" so the app_name should be app_name="blog" outside the url_patterns list.
Answered on: Aug. 16, 2018, 5:29 p.m.
Answered by: admin