#27238: Removal of check_pattern_startswith_slash --------------------------------------+-------------------- Reporter: strycore | Owner: nobody Type: Cleanup/optimization | Status: new Component: Core (System checks) | Version: 1.10 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------------+-------------------- I would like to propose the removal of the check_pattern_startswith_slash system check as there are legitimate reasons to have url patterns starting with a slash and this warning can be misleading.
The Django framework has a strong bias in favor of trailing slashes in URLs but not everyone wishes to set up their urls that way. If this warning was to be respected, it's impossible to have urls without a trailing slash in some situations: {{{ # myapp. urls urlpatterns = [ url(r'^dashboard', include('dashboard.urls')), ] # dashboard.urls urlpatterns = [ url(r'^$', views.dashboard_home, name='dashboard_home'), url(r'^/users$', views.users, name='dashboard_users'), ] }}} The above URLconfs allow to have the URLs /dashboard and /dashboard/users but it will produce the warning. When trying to make the slash optional in the root URLconf with {{{r'^dashboard/?'}}}, the 2nd url will reverse to /dashboardusers. I know that some system checks can be silenced but I'd be in favor of the complete removal of the check since it can be misleading for users who do not wish trailing slashes in their URLs. -- Ticket URL: <https://code.djangoproject.com/ticket/27238> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.771ed5875283d370598c3ef05a5c35fe%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.