Django optional url parameters
问题 I have a Django URL like this: url( r\'^project_config/(?P<product>\\w+)/(?P<project_id>\\w+)/$\', \'tool.views.ProjectConfig\', name=\'project_config\' ), views.py: def ProjectConfig(request, product, project_id=None, template_name=\'project.html\'): ... # do stuff The problem is that I want the project_id parameter to be optional. I want /project_config/ and /project_config/12345abdce/ to be equally valid URL patterns, so that if project_id is passed, then I can use it. As it stands at the