book2-exercises icon indicating copy to clipboard operation
book2-exercises copied to clipboard

updated solution for django 2.0 ?

Open mm-git01 opened this issue 7 years ago • 1 comments

recently i encountered a include() error while passing the url to the app using django 2.0.The solutions here seem to be somewhat different since the tutorial teaches django 1.xx a newer solution would be appreciated.

i was doing the bloggy_project

mm-git01 avatar Jan 02 '18 10:01 mm-git01

The new syntax supports type coercion of URL parameters. In the example, the view will receive the year keyword argument as an integer rather than as a string. Also, the URLs that will match are slightly less constrained in the rewritten example. For example, the year 10000 will now match since the year integers aren’t constrained to be exactly four digits long as they are in the regular expression.

The django.conf.urls.url() function from previous versions is now available as django.urls.re_path(). The old location remains for backwards compatibility, without an imminent deprecation.

The old django.conf.urls.include() function is now importable from django.urls so you can use from django.urls import include, path, re_path in your URLconfs.

varnaa avatar Feb 05 '19 16:02 varnaa