book2-exercises
book2-exercises copied to clipboard
updated solution for django 2.0 ?
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
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.