Hi All,
I'm not sure whether this is a feature or a bug, so I thought it best to
air it here before filing a bug report.
In short I have a URL which will be '/api/v1/case/' if APPEND_SLASH false
True, or '/api/v1 case' if APPEND_SLASH = False.
To reproduce this, I have a project urls.py file with the following
path('api/v1', include('api.urls')) - (note there is no trailing slash)
And an api/urls.py with the following
path('case', CasesView.as_view(), name='all-cases'),
What I assume is happening is that my complete URL is made up of two URLs,
namely the first URL from the project urls.py file and the second URL from
api/urls.py, and that the method that append's a slash to URLs is appending
a slash to both of them. If you have APPEND_SLASH to True, then the URL is
accessible via '/api/v1/case/' or '/api/v1/case', but if it APPEND_SLASH is
False, then the URL becomes '/api/v1 case'
The thing that makes me think that perhaps this isn't a bug, is that I
seemingly just didn't configure Django properly. It could be as simple as
that.
However, the reason I think this is a bug, is that the behaviour, at least
to me is non-obvious. That's not to say when you stop and think about it
that it isn't perhaps logical, if indeed there are two URLs which have
slashes appended to them in order to make the final URL, but on first
glance when I read about Django's APPEND_SLASH feature, I think of the
final URL, the one that the user will see, not of two separate URLs that
are being put together to make the final product.
Please let me know your thoughts and if you think it is a bug or not.
Cheers,
Conor
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/3406b3f2-76ad-4db1-817c-309161569195%40googlegroups.com.