I would like to see if this could be done as a third-party project (allow
"pluggable URLs" which could use any syntax). If not, then let's accept a
patch to Django to support it. Over time, if there's some strong consensus
about a particular third-party package, then we could bring it in to
One problem with this approach, to let the community decide on this type of
feature, is the target audience of it. This is mainly a feature for
beginners, and more experienced users are expected to switch over to using
regexes directly to get the exact behavior they want. Beginners likely
Hi,
Good to hear so much from you.
Just want know more, could anyone also explain why at first Django
chose to use regex instead of a simple URL routing, except for the
flexibility?
By the way, like you said, routing in flask (or should say Werkzeug?) is
also
converting the simple URLs into
There is third party module providing third party url function. Surlex
[1] have been mentionned. But any third party solution will need to
provide function compatible with django.conf.urls.url.
Line 64 of django/urls/revolvers.py is get_resolver. This function
return a RegexURLResolver, using is
So it looks to me that the consensus is that this IS in fact a good idea,
to supply a simpler, regex-free method to define URL:s.
It also seems that the best liked version is something that's similar to
what flask uses: /articles///.
I've never written a DEP before, but it sounds like a fun
Emil,
Please count me in if you'd like to start a new DEP. I'm also
very interested to take this new challenge. And maybe we
should dive into the code of URL resolver part of Django before
we actually kick off?
Anyway, I myself as a experienced user also like this idea. But as
Tim and Ludovic
https://github.com/django/django/pull/7153/ implements
UserManager.with_perm() [1] as:
def with_perm(self, perm):
for backend in auth.get_backends():
if hasattr(backend, 'with_perm'):
return backend.with_perm(perm)
return self.get_queryset().none()
This is actually an interesting concept, and wouldn't incur an overheard at
runtime if simple_url translated in to full regex format at launch time (or
on first request, which is when the urls get loaded if I recall correctly).
I don't think this would get in the way of includes, and if it's
Thank you for your input, Jarek.
Assuming I have an existing model, adding
models.CharField(blank=True, max_length=150)
to it, doesn't invoke the questioner on current master. Changing this
field to
models.CharField(max_length=150)
doesn't call the questioner either.
Looking at the
Hi Ares,
Your suggestion, used in urls.py would translate to:
from django.conf.urls import simple_url
from . import views
urlpatterns = [
simple_url('articles/2003/', views.special_case_2003),
simple_url('articles//', views.year_archive),
simple_url('articles///',
This is actually an interesting concept, and wouldn't incur an, overheard
at runtime if simple_url translated in to full regex format at launch time
(or on first request, which is when the urls get loaded if I recall
correctly).
I don't think this would get in the way of includes, and if it's a
Hi Robert,
Thanks for doing this load testing. More context would be useful to help us
outside observers to understand the potentially different variables. Is
redis running locally or are you using elasticache?
Regards,
Michael Manfre
On Mon, Sep 12, 2016 at 9:41 PM Robert Roskam
Hi,
I don't think that the 'including' URLs part forms a problem here.
For the given example, it should be easily doable
> from django.conf.urls import simple_url
> from . import views
> urlpatterns = [
> simple_url('articles/2003/', views.special_case_2003),
>
Hi,
Actually flask uses a style very similar to what you want.
To my knowing, you must use this pattern for Django because it has the
concept of *including *
URLs.
Routing in flask:
@app.route('post/', methods=['GET'])
def post_view(post_id=None):
# do something to render the post
> Den 13. sep. 2016 kl. 09.28 skrev Erik Cederstrand
> :
>
> First of all, thanks for taking the time to actually do the measurements!
> It's insightful and very much appreciated.
>
> [...]300K requests in 10 minutes is 500 rps, but the text says 500 rps. Which
>
Hi Emil,
There are projects like https://github.com/codysoyland/surlex which I like
very much. In the end, whatever you can come up which translates to regex
in the background would work just fine for django. I personally like what
werkzeug does -- "stealing" that sounds like an idea too :D I
> Den 13. sep. 2016 kl. 03.41 skrev Robert Roskam :
>
> Hey Chris,
>
> The goal of these tests is to see how channels performs with normal HTTP
> traffic under heavy load with a control. In order to compare accurately, I
> tried to eliminate variances as much as
Tjena Emil,
On Mon, Sep 12, 2016 at 01:32:45PM -0700, Emil Stenström wrote:
> Hi Djangonauts,
>
> I'm just back from my second year of teaching Django to absolute beginners.
> The course is a combination of HTML, CSS, Python, and Django, and after
> five days of coding they have a real live
18 matches
Mail list logo