diff --git a/djinit/utils/common.py b/djinit/utils/common.py index eb9e13e..4af222c 100644 --- a/djinit/utils/common.py +++ b/djinit/utils/common.py @@ -51,7 +51,7 @@ def create_file_from_template( def create_init_file(directory: str, success_message: str) -> None: init_path = os.path.join(directory, "__init__.py") - create_file_from_template(init_path, "project/init.j2", {}, success_message, should_format=False) + create_file_from_template(init_path, "project/init.py-tpl", {}, success_message, should_format=False) def create_directory_with_init(dir_path: str, message: str) -> None: diff --git a/djinit/utils/django.py b/djinit/utils/django.py index f893210..87cb233 100644 --- a/djinit/utils/django.py +++ b/djinit/utils/django.py @@ -25,7 +25,7 @@ class DjangoHelper: manage_py_path = os.path.join(directory, "manage.py") create_file_from_template( - manage_py_path, "project/manage_py.j2", {"project_name": project_name}, "Created manage.py" + manage_py_path, "project/manage.py-tpl", {"project_name": project_name}, "Created manage.py" ) os.chmod(manage_py_path, 0o755) @@ -40,17 +40,17 @@ class DjangoHelper: base_context = {"project_name": project_name, "app_names": []} settings_files = [ - ("base.py", "config/settings/base.j2", base_context), - ("development.py", "config/settings/development.j2", {}), - ("production.py", "config/settings/production.j2", {}), + ("base.py", "config/settings/base.py-tpl", base_context), + ("development.py", "config/settings/development.py-tpl", {}), + ("production.py", "config/settings/production.py-tpl", {}), ] create_files_from_templates(settings_dir, settings_files, f"{project_name}/settings/") - urls_context = {"project_name": project_name, "django_version": DjangoHelper.DJANGO_VERSION} + urls_context = {"url_type": "project", "project_name": project_name, "django_version": DjangoHelper.DJANGO_VERSION} project_files = [ - ("urls.py", "config/urls/base.j2", urls_context), - ("wsgi.py", "config/wsgi.j2", {}), - ("asgi.py", "config/asgi.j2", {}), + ("urls.py", "config/urls.py-tpl", urls_context), + ("wsgi.py", "config/wsgi.py-tpl", {}), + ("asgi.py", "config/asgi.py-tpl", {}), ] create_files_from_templates(project_config_dir, project_files, f"{project_name}/") @@ -70,14 +70,14 @@ class DjangoHelper: create_init_file(app_dir, f"Created {app_name}/__init__.py") app_files = [ - ("apps.py", "components/apps.j2", context), - ("models.py", "components/models.j2", context), - ("views.py", "components/views.j2", context), - ("admin.py", "components/admin.j2", context), - ("urls.py", "components/urls.j2", context), - ("serializers.py", "components/serializers.j2", context), - ("routes.py", "components/routes.j2", context), - ("tests.py", "components/tests.j2", context), + ("apps.py", "components/apps.py-tpl", context), + ("models.py", "components/models.py-tpl", context), + ("views.py", "components/views.py-tpl", context), + ("admin.py", "components/admin.py-tpl", context), + ("urls.py", "config/urls.py-tpl", {"url_type": "component"}), + ("serializers.py", "components/serializers.py-tpl", context), + ("routes.py", "components/routes.py-tpl", context), + ("tests.py", "components/tests.py-tpl", context), ] create_files_from_templates(app_dir, app_files, f"{app_name}/")