Repository: imAsparky/django-cookiecutter

Issue:
[CHORE]: Remove redundant cookiecutter options in setup.
**What is the chore?**

### Remove these wherever they are sprinkled.  Defaulting to having these in the `.env files` to keep things simple.
ALLOWED_HOSTS = ["{{cookiecutter.ALLOWED_HOSTS}}"]

INTERNAL_IPS = ["{{cookiecutter.INTERNAL_IPS}}"]


Discussion:

Resolving patch:
diff --git a/{{cookiecutter.git_project_name}}/config/settings/local.py b/{{cookiecutter.git_project_name}}/config/settings/local.py
--- a/{{cookiecutter.git_project_name}}/config/settings/local.py
+++ b/{{cookiecutter.git_project_name}}/config/settings/local.py
@@ -18,12 +18,17 @@
 )  # noqa: F405
 
 logger = logging.getLogger(__name__)
-
-
+{% if cookiecutter.ALLOWED_HOSTS == [] %}
+ALLOWED_HOSTS = env.list(
+    "LOCAL_ALLOWED_HOSTS",
+    default=["127.0.0.1"],
+)
+{% else %}
 ALLOWED_HOSTS = env.list(
     "LOCAL_ALLOWED_HOSTS",
-    default=["local.trader-biz.au"],
+    default=["{{cookiecutter.ALLOWED_HOSTS}}"],
 )
+{% endif %}
 
 DEBUG = env("LOCAL_DJANGO_DEBUG", default=False)
 
@@ -121,7 +126,7 @@
 
 INTERNAL_IPS = env.list(
     "LOCAL_DJANGO_INTERNAL_IPS",
-    default=[],
+    default=["{{cookiecutter.INTERNAL_IPS}}"],
 )
 
 # Override the default logger level to the django environment


Test patch:
diff --git a/tests/test_bake_django.py b/tests/test_bake_django.py
--- a/tests/test_bake_django.py
+++ b/tests/test_bake_django.py
@@ -940,6 +940,27 @@ def test_baked_django_settings_local_file_ok(cookies):
     assert (
         '"""Django local settings for django-boilerplate project."""' in settings_file
     )
+    assert '    "LOCAL_ALLOWED_HOSTS",' in settings_file
+    assert '    default=[""],' in settings_file
+    assert ')' in settings_file
+
+def test_baked_django_settings_local_file_with_ALLOWED_HOSTS_ok(cookies):
+    """Test Django MIT license file has been generated correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "ALLOWED_HOSTS": "example.com",
+        }
+    )
+
+    settings_path = non_default_django.project_path / "config/settings/local.py"
+    settings_file = settings_path.read_text().splitlines()
+
+    assert (
+        '"""Django local settings for django-boilerplate project."""' in settings_file
+    )
+    assert '    "LOCAL_ALLOWED_HOSTS",' in settings_file
+    assert '    default=["example.com"],' in settings_file
+    assert ')' in settings_file
 
 
 def test_baked_django_settings_production_file_ok(cookies):
@@ -955,12 +976,28 @@ def test_baked_django_settings_production_file_ok(cookies):
         '"""Django production settings for django-boilerplate project."""'
         in settings_file
     )
-    '    default=["trader-biz.au"],'
     assert '    "PROD_ALLOWED_HOSTS",' in settings_file
     assert '    default=[""],' in settings_file
     assert ')' in settings_file
 
+def test_baked_django_settings_production_file_with_ALLOWED_HOSTS_ok(cookies):
+    """Test Django MIT license file has been generated correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "ALLOWED_HOSTS": "example.com",
+        }
+    )
 
+    settings_path = non_default_django.project_path / "config/settings/production.py"
+    settings_file = settings_path.read_text().splitlines()
+
+    assert (
+        '"""Django production settings for django-boilerplate project."""'
+        in settings_file
+    )
+    assert '    "PROD_ALLOWED_HOSTS",' in settings_file
+    assert '    default=["example.com"],' in settings_file
+    assert ')' in settings_file
 
 def test_baked_django_settings_staging_file_ok(cookies):
     """Test Django config/settings/staging.py file has generated correctly."""
@@ -976,6 +1013,23 @@ def test_baked_django_settings_staging_file_ok(cookies):
     assert '    default=[""],' in settings_file
     assert ')' in settings_file
 
+def test_baked_django_settings_staging_file_with_ALLOWED_HOSTS_ok(cookies):
+    """Test Django MIT license file has been generated correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "ALLOWED_HOSTS": "example.com",
+        }
+    )
+
+    settings_path = non_default_django.project_path / "config/settings/staging.py"
+    settings_file = settings_path.read_text().splitlines()
+
+    assert (
+        '"""Django staging settings for django-boilerplate project."""' in settings_file
+    )
+    assert '    "STAGING_ALLOWED_HOSTS",' in settings_file
+    assert '    default=["example.com"],' in settings_file
+    assert ')' in settings_file
 
 def test_baked_django_settings_test_file_ok(cookies):
     """Test Django config/settings/test.py file has generated correctly."""
@@ -989,6 +1043,22 @@ def test_baked_django_settings_test_file_ok(cookies):
     assert '    default=[""],' in settings_file
     assert ')' in settings_file
 
+def test_baked_django_settings_test_file_with_ALLOWED_HOSTS_ok(cookies):
+    """Test Django MIT license file has been generated correctly."""
+    non_default_django = cookies.bake(
+        extra_context={
+            "ALLOWED_HOSTS": "example.com",
+        }
+    )
+
+    settings_path = non_default_django.project_path / "config/settings/test.py"
+    settings_file = settings_path.read_text().splitlines()
+
+    assert '"""Django test settings for django-boilerplate project."""' in settings_file
+    assert '    "TESTING_ALLOWED_HOSTS",' in settings_file
+    assert '    default=["example.com"],' in settings_file
+    assert ')' in settings_file
+
 
 def test_baked_django_tox_file_ok(cookies):
     """Test Django tox.ini file has been generated correctly."""