Hi,

I just want to point out that there is similar work done for the core.

https://github.com/django/deps/blob/master/accepted/0201-simplified-routing-syntax.rst

If we're lucky it will be available in Django 2.0.

21.8.2017 0.07 "Malik Brahimi" <[email protected]> kirjoitti:

> Hey guys! Do you mind checking out my new package and letting me know what
> you think? Essentially it is a Flask inspired routing system for Django
> (only Python2.x) that works by recursively searching through a folder, for
> example:
>
> pip install djroute
>
>
> urls.py
>
> from djroute import root, traverse
>
> urlpatterns = [
>
>     # base pattern with admin routes
>
>     url(r'^admin/', admin.site.urls),
>
> ]
>
> # goes into folders relative to project root
>
> views = root('app_name', 'views')
>
>
> for i in traverse(views):
>
>     # add URLS to patterns
>
>     urlpatterns.append(i)
>
>
>
> djroute will recurse the entire tree defined with the root function by
> joining paths together
>
>
> for example a subpackage might have a folder called banks with a folder
> inside called citizens with different modules one of which looks like so
>
> from djroute import route
>
> # @route(PATH:required, NAME:optional)
>
> @route('fn', 'funcview')
> def funcview(request):
>    # do something
>
> @route('cls', 'classview')
> class classview(View):
>
>    # do something in methods
>
> This would generate the routes
>
> ^banks/citizens/fn/$ with name funcview
>
> ^banks/citizens/cls/$ with name classview
>
>
> if you like the packages to take a different name from their folder name,
> define PATH in __init__.py
>
> Let me know if this does not make sense
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/c48d9b75-1b70-4bd1-bcf7-dbfde80eb1b6%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/c48d9b75-1b70-4bd1-bcf7-dbfde80eb1b6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91odAS0QBkKwerRzG%3DrB0bzFpHvnqvvCL_PkicLARCv9Npg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to