Python Forum

Full Version: Django URL dispatcher help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Need help with URLconf

The parameter can be a directory or a file name. For example:

gallery/Some/Directory/
gallery/SomeDirectory/
gallery/Some/Directory/In/Directory

Should go to: "views.gallery" with parameter folder: "Some/Directory" or "SomeDirectory" or "Some/Directory/In/Directory"

But if it ends with filename:

gallery/Some/Directory/photo123.jpg
gallery/SomeDirectory/photo432.jpg
gallery/Some/Directory/In/Directory/image343.jpg

Should go to: "views.photo" with parameter: folder: "Some/Directory" and filename: "photo123.jpg" and so on..

How I can configure this in urls.py ?