Django URL dispatcher help - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Django URL dispatcher help (/thread-23180.html) |
Django URL dispatcher help - giga - Dec-14-2019 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 ? |