fix(src/djinit/creators): add project_name to urls_context and urls.py template context

- Ensure project_name is passed when generating urls.py, preventing TemplateError.
- Improves template rendering consistency for API route inclusion.
This commit is contained in:
sankalp committed 2026-05-28 10:34:05 +05:45
1 parent e8176a1ff5
commit 7bac6b176e
1 file changed
+7 -2
+7 -2
View File
@@ -117,7 +117,12 @@ class FileCreator(BaseService):
) -> None:
"""Helper to create urls.py, wsgi.py, and asgi.py."""
urls_context = {"url_type": "project", "api_module": api_module, "include_api": True}
urls_context = {
"url_type": "project",
"project_name": self.project_name,
"api_module": api_module,
"include_api": True,
}
if comment_out_api:
urls_context["comment_out_api_url"] = True
@@ -303,7 +308,7 @@ class FileCreator(BaseService):
CommonUtils.create_file_from_template(
project_urls_path,
"config/urls.py-tpl",
{"url_type": "project", "api_module": "api", "include_api": True},
{"url_type": "project", "project_name": self.project_name, "api_module": "api", "include_api": True},
"Updated project urls.py to include API routes",
should_format=True,
)