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