internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: cookiecutter/cookiecutter-django

Issue:
Add GPLv3 in the choice of licences
When choosing a licence, we are provided with the following choices:

```
Select open_source_license:
1 - MIT
2 - BSD
3 - Apache Software License 2.0
4 - Not open source
```

It would be nice to be able to select a GPLv3 licence too.



Discussion:
We accept pull requests. Why not submit one and get contributor status?


Resolving patch:
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -195,6 +195,15 @@ def remove_certbot_files():
         file_name = os.path.join(nginx_dir_location, filename)
         remove_file(file_name)
 
+def remove_copying_files():
+    """
+    Removes files needed for the GPLv3 licence if it isn't going to be used
+    """
+    for filename in ["COPYING"]:
+        os.remove(os.path.join(
+            PROJECT_DIRECTORY, filename
+        ))
+
 # IN PROGRESS
 # def copy_doc_files(project_directory):
 #     cookiecutters_dir = DEFAULT_CONFIG['cookiecutters_dir']
@@ -275,5 +284,9 @@ def remove_certbot_files():
         "You must generate a dhparams.pem file before running docker-compose in a production environment."
     )
 
+# 11. Removes files needed for the GPLv3 licence if it isn't going to be used.
+if '{{ cookiecutter.open_source_license}}' != 'GPLv3':
+    remove_copying_files()
+
 # 4. Copy files from /docs/ to {{ cookiecutter.project_slug }}/docs/
 # copy_doc_files(PROJECT_DIRECTORY)


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
apps.UsersConfig prevents celery task autodiscovery
Celery tasks that are created in `users/tasks.py` are not picked up automatically.

Probably because the `users` app is added to `INSTALLED_APPS` by pointing to the `UsersConfig` class instead of loading the module.



Discussion:
You have to use explicit task discovery in the settings, specifically:

``` python
CELERY_IMPORTS = ("scoops.users.tasks", )
```

Adding that as a setting doesn't work, but perhaps we should document it. 


Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
@@ -2,7 +2,7 @@
 from __future__ import absolute_import
 import os
 from celery import Celery
-from django.apps import AppConfig
+from django.apps import apps, AppConfig
 from django.conf import settings
 
 
@@ -22,7 +22,8 @@ def ready(self):
         # Using a string here means the worker will not have to
         # pickle the object when using Windows.
         app.config_from_object('django.conf:settings')
-        app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, force=True)
+        installed_apps = [app_config.name for app_config in apps.get_app_configs()]
+        app.autodiscover_tasks(lambda: installed_apps, force=True)
 
         {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}
         if hasattr(settings, 'RAVEN_CONFIG'):


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Update README with gulp option
Now that we have gulp support, the README needs to be updated in a few places.
- Mention the features our Gulpfile provides
- Update the example prompts



Discussion:

Resolving patch:
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -256,7 +256,6 @@ def remove_open_source_files():
 else:
     remove_gulp_files()
     remove_grunt_files()
-    remove_packageJSON_file()
 
 # 7. Removes all certbot/letsencrypt files if it isn't going to be used
 if '{{ cookiecutter.use_lets_encrypt }}'.lower() != 'y':
@@ -264,11 +263,10 @@ def remove_open_source_files():
 
 # 8. Display a warning if use_docker and use_grunt are selected. Grunt isn't
 #   supported by our docker config atm.
-if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt', 'gulp'] and '{{ cookiecutter.use_docker }}'.lower() == 'y':
+if '{{ cookiecutter.js_task_runner }}'.lower() in ['grunt'] and '{{ cookiecutter.use_docker }}'.lower() == 'y':
     print(
-        "You selected to use docker and a JS task runner. This is NOT supported out of the box for now. You "
-        "can continue to use the project like you normally would, but you will need to add a "
-        "js task runner service to your docker configuration manually."
+        "You selected to use Docker and Grunt task runner. This is NOT supported out of the box for now. You "
+        "can continue to use the project like you normally would, but you will need to setup Grunt manually."
     )
 
 # 9. Removes the certbot/letsencrypt files and display a warning if use_lets_encrypt is selected and use_docker isn't.
diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py
--- a/{{cookiecutter.project_slug}}/config/settings/base.py
+++ b/{{cookiecutter.project_slug}}/config/settings/base.py
@@ -184,9 +184,10 @@
 # See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
 STATIC_URL = '/static/'
 
+_STATIC_BUILD_ROOT_DIR_NAME = 'build'
 # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#std:setting-STATICFILES_DIRS
 STATICFILES_DIRS = [
-    str(APPS_DIR.path('static')),
+    (_STATIC_BUILD_ROOT_DIR_NAME, str(APPS_DIR.path('static').path(_STATIC_BUILD_ROOT_DIR_NAME))),
 ]
 
 # See: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Add a pre-hook that checks the python version
Since we no longer support Python 2.7 in target environments we should have a pre-hook that if called by Python 2.7, produces a warning stating and a continuation (y/N) that the project won't run on Python 2.7. It won't stop the project generation, but will warn the user that they need to run it in Python 3.


Discussion:

Resolving patch:
diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py
--- a/hooks/pre_gen_project.py
+++ b/hooks/pre_gen_project.py
@@ -9,3 +9,23 @@
 
 if elasticbeanstalk == 'y' and (heroku == 'y' or docker == 'y'):
     raise Exception("Cookiecutter Django's EXPERIMENTAL Elastic Beanstalk support is incompatible with Heroku and Docker setups.")
+
+if docker == 'n':
+	import sys
+
+	python_major_version = sys.version_info[0]
+
+	if python_major_version == 2:
+		sys.stdout.write("WARNING: Cookiecutter Django does not support Python 2! Stability is guaranteed with Python 3.4+ only. Are you sure you want to proceed? (y/n)")
+
+		yes_options = set(['y'])
+		no_options = set(['n', ''])
+		choice = raw_input().lower()
+		if choice in no_options:
+			sys.exit(1)
+		elif choice in yes_options:
+			pass
+		else:
+			sys.stdout.write("Please respond with %s or %s" 
+				% (', '.join([o for o in yes_options if not o == ''])
+					, ', '.join([o for o in no_options if not o == ''])))


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
CELERY_BROKER_URL naming mismatch
As of now, we `export CELERY_BROKER_URL` in `./compose/django/entrypoint.sh`, yet in `./config/settings/base.py` we utilize the unprefixed `BROKER_URL`.

Is this a mismatch?

Moreover, it's clear from [Celery migration docs](http://docs.celeryproject.org/en/latest/whatsnew-4.0.html#lowercase-setting-names) that prefixing celery settings with `CELERY_` is recommended since 4.0, so I guess we should upgrade our settings, also renaming `BROKER_URL` to `CELERY_BROKER_URL`. I can provide a PR.


Discussion:
I noticed `BROKER_URL` is populated from `CELERY_BROKER_URL` in Celery [Dockerfile](https://github.com/docker-library/celery/blob/96de4372507fc4eb147f43b8c4f207da3d95bcd1/4.0/Dockerfile) to be further written to `celeryconfig.py`. 
It's probably a mismatch. Submit the PR!
@pydanny, on my way.

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/base.py b/{{cookiecutter.project_slug}}/config/settings/base.py
--- a/{{cookiecutter.project_slug}}/config/settings/base.py
+++ b/{{cookiecutter.project_slug}}/config/settings/base.py
@@ -267,11 +267,11 @@
 {% if cookiecutter.use_celery == 'y' %}
 ########## CELERY
 INSTALLED_APPS += ['{{cookiecutter.project_slug}}.taskapp.celery.CeleryConfig']
-BROKER_URL = env('CELERY_BROKER_URL', default='django://')
-if BROKER_URL == 'django://':
+CELERY_BROKER_URL = env('CELERY_BROKER_URL', default='django://')
+if CELERY_BROKER_URL == 'django://':
     CELERY_RESULT_BACKEND = 'redis://'
 else:
-    CELERY_RESULT_BACKEND = BROKER_URL
+    CELERY_RESULT_BACKEND = CELERY_BROKER_URL
 ########## END CELERY
 {% endif %}
 


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Rename dev.yml to local.yml
That would match up with `local.py` and `local.txt`. 

@pydanny, @jayfk, @luzfcb what do you think?


Discussion:
Yep 👍 .

Resolving patch:
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -130,7 +130,7 @@ def remove_docker_files():
     """
     Removes files needed for docker if it isn't going to be used
     """
-    for filename in ["dev.yml", "docker-compose.yml", ".dockerignore"]:
+    for filename in ["local.yml", "production.yml", ".dockerignore"]:
         os.remove(os.path.join(
             PROJECT_DIRECTORY, filename
         ))
@@ -296,4 +296,4 @@ def remove_open_source_files():
 
 # 13. Remove files conventional to opensource projects only.
 if '{{ cookiecutter.open_source_license }}' == 'Not open source':
-    remove_open_source_files()
\ No newline at end of file
+    remove_open_source_files()


Test patch:
diff --git a/tests/test_docker.sh b/tests/test_docker.sh
--- a/tests/test_docker.sh
+++ b/tests/test_docker.sh
@@ -15,7 +15,7 @@ cookiecutter ../../ --no-input --overwrite-if-exists use_docker=y js_task_runner
 cd project_name
 
 # run the project's tests
-docker-compose -f dev.yml run django python manage.py test
+docker-compose -f local.yml run django python manage.py test
 
 # return non-zero status code if there are migrations that have not been created
-docker-compose -f dev.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
+docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
Repository: cookiecutter/cookiecutter-django

Issue:
Set CONN_MAX_AGE in DATABASE_URL
[CONN_MAX_AGE](https://docs.djangoproject.com/en/1.9/ref/databases/#persistent-connections) defaults to 0. I think it would be nice for us to be more opinionated about it, setting it to a non-zero value by default.

[StackOverflow](http://stackoverflow.com/questions/19937257/what-is-a-good-value-for-conn-max-age-in-django) suggests 60, [RevSys](http://www.revsys.com/blog/2015/may/06/django-performance-simple-things/) suggests 600 (10 min). I lean toward 600 since we're using allauth and authenticated users tend to stick around a site longer.



Discussion:
I would go with 1min, as 10mins way to much for default, having a larger value can have hard to debug issue, soaking up db connection limit. 

With 1min: 
1) we are providing a placeholder which people can see and update as needed (still better if configurable with env variable) 
2) 60sec is a decent for moderately crowded site.


Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -169,7 +169,7 @@
     ('django.template.loaders.cached.Loader', [
         'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ]),
 ]
-
+{% set _DEFAULT_CONN_MAX_AGE=60 %}
 # DATABASE CONFIGURATION
 # ------------------------------------------------------------------------------
 {% if cookiecutter.use_elasticbeanstalk_experimental.lower() == 'y' -%}
@@ -182,12 +182,14 @@
         'PASSWORD': env('RDS_PASSWORD'),
         'HOST': env('RDS_HOSTNAME'),
         'PORT': env('RDS_PORT'),
+        'CONN_MAX_AGE': env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }}),
     }
 }
 {% else %}
 # Use the Heroku-style specification
 # Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
 DATABASES['default'] = env.db('DATABASE_URL')
+DATABASES['default']['CONN_MAX_AGE'] = env.int('CONN_MAX_AGE', default={{ _DEFAULT_CONN_MAX_AGE }})
 {%- endif %}
 
 # CACHING


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
wsgi.py: Bug in app_path when project path includes /config not just at the end
This bug occurs because the resulting path has replaced every ocurrence of /config in the project path:

``` python
# config/wsgi.py:

app_path = os.path.dirname(os.path.abspath(__file__)).replace('/config', '')
```

If project path is something like: ```/var/www/config/whatever/src/config/wsgi.py``` the above line is going to convert it into ```/var/www/whatever/src``` when it sould be ```/var/www/config/whatever/src```.

**This fixes the problem:**

``` python
# config/wsgi.py:

app_path = os.path.abspath(os.path.join(
    os.path.dirname(os.path.abspath(__file__)), os.pardir))
```





Discussion:

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/wsgi.py b/{{cookiecutter.project_slug}}/config/wsgi.py
--- a/{{cookiecutter.project_slug}}/config/wsgi.py
+++ b/{{cookiecutter.project_slug}}/config/wsgi.py
@@ -20,7 +20,8 @@
 
 # This allows easy placement of apps within the interior
 # {{ cookiecutter.project_slug }} directory.
-app_path = os.path.dirname(os.path.abspath(__file__)).replace('/config', '')
+app_path = os.path.abspath(os.path.join(
+    os.path.dirname(os.path.abspath(__file__)), os.pardir))
 sys.path.append(os.path.join(app_path, '{{ cookiecutter.project_slug }}'))
 
 {% if cookiecutter.use_sentry_for_error_reporting == 'y' -%}


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Opbeat sunset
Opbeat is joining Elastic and they are planning to sunset the service May 24, 2018. The new service will be called Elastic APM, and has [entered into GA phase](https://www.elastic.co/blog/elastic-apm-ga-released) recently. Might be time to drop this option from this cookiecutter?

(x-refs #559 #449)


Discussion:

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -289,21 +289,6 @@
     }
 }
 
-{%- endif %}
-{% if cookiecutter.use_opbeat == 'y' -%}
-# opbeat
-# ------------------------------------------------------------------------------
-# https://opbeat.com/docs/articles/get-started-with-django/#setup
-INSTALLED_APPS += ['opbeat.contrib.django']  # noqa F405
-# https://opbeat.com/docs/articles/get-started-with-django/#setup
-OPBEAT = {
-    'ORGANIZATION_ID': env('DJANGO_OPBEAT_ORGANIZATION_ID'),
-    'APP_ID': env('DJANGO_OPBEAT_APP_ID'),
-    'SECRET_TOKEN': env('DJANGO_OPBEAT_SECRET_TOKEN')
-}
-# https://opbeat.com/docs/articles/get-started-with-django/#performance-metrics
-MIDDLEWARE = ['opbeat.contrib.django.middleware.OpbeatAPMMiddleware'] + MIDDLEWARE
-
 {%- endif %}
 # Your stuff...
 # ------------------------------------------------------------------------------
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/taskapp/celery.py
@@ -46,32 +46,6 @@ def ready(self):
             raven_register_signal(raven_client)
         {%- endif %}
 
-        {% if cookiecutter.use_opbeat == 'y' -%}
-        if hasattr(settings, 'OPBEAT'):
-{% if cookiecutter.use_pycharm == 'y' -%}
-            # Since opbeat is required in production only,
-            # imports might (most surely will) be wiped out
-            # during PyCharm code clean up started
-            # in other environments.
-            # @formatter:off
-{%- endif %}
-            from opbeat.contrib.django.models import client as opbeat_client
-            from opbeat.contrib.django.models import logger as opbeat_logger
-            from opbeat.contrib.django.models import register_handlers as opbeat_register_handlers
-            from opbeat.contrib.celery import register_signal as opbeat_register_signal
-{% if cookiecutter.use_pycharm == 'y' -%}
-            # @formatter:on
-{%- endif %}
-
-            try:
-                opbeat_register_signal(opbeat_client)
-            except Exception as e:
-                opbeat_logger.exception(f'Failed installing celery hook: {e}')
-
-            if 'opbeat.contrib.django' in settings.INSTALLED_APPS:
-                opbeat_register_handlers()
-        {%- endif %}
-
 
 @app.task(bind=True)
 def debug_task(self):


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Celery code blocks are still generated even though Celery is not opted out for



Discussion:

Resolving patch:
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -254,6 +254,11 @@ def remove_celery_envs():
     os.remove(os.path.join('.envs', '.production', '.celery'))
 
 
+def remove_celery_compose_dirs():
+    shutil.rmtree(os.path.join('compose', 'local', 'django', 'celery'))
+    shutil.rmtree(os.path.join('compose', 'production', 'django', 'celery'))
+
+
 def main():
     postgres_user = generate_postgres_user()
     set_flags_in_envs(postgres_user)
@@ -318,6 +323,7 @@ def main():
         remove_celery_app()
         if '{{ cookiecutter.use_docker }}'.lower() == 'y':
             remove_celery_envs()
+            remove_celery_compose_dirs()
 
     if '{{ cookiecutter.use_travisci }}'.lower() == 'n':
         remove_dottravisyml_file()


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
Selected Gulp and CSS compilation. `npm run dev` does not run automatically when docker-compose build+up is invoked

I have selected CSS compilation to be enabled and have chosen Gulp to be used as a task runner.  
When `docker-compose up` is  invoked auto compilation of css does not take place. I have to manually install nodejs, npm, gulp, compass to get the whole thing working. 

I also had to run npm run dev manually.

It kind of feels like a leaky abstraction, when some setup and commands work automatically, while others don't.

The expectation is that,  because of the choices made while setting up the project, `npm run dev` command will be automatically started, when docker-compose is invoked.

It also appears that the DockerFile does not install nodejs, npm or gulp in spite of choosing Gulp as task runner.

It should be trivial to incorporate.

The gulp task runner already has `python manage.py runserver` as one of it's options. So all the start script has to do is run `npm run dev` instead of `python manage.py runserver_plus`. (The gulpfile.js should be changed to use runserver_plus instead of runserver).

One way to incorporate this would be to have two Dockerfiles, one where gulp and bootstrap compilation is enabled and one where gulp and bootstrap compilation is disabled.


I am new to the cookiecutter-django community. So maybe I am missing something obvious. If so, I would be very interested in knowing the reasons behind not incorporating the above steps.

If there is interest in the community, I would be happy to implement the solution after discussing and deciding on the right way to do the same.




Discussion:

Resolving patch:
diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py
--- a/hooks/post_gen_project.py
+++ b/hooks/post_gen_project.py
@@ -267,6 +267,10 @@ def remove_celery_compose_dirs():
     shutil.rmtree(os.path.join("compose", "production", "django", "celery"))
 
 
+def remove_node_dockerfile():
+    shutil.rmtree(os.path.join("compose", "local", "node"))
+
+
 def main():
     debug = "{{ cookiecutter.debug }}".lower() == "y"
 
@@ -313,21 +317,8 @@ def main():
     if "{{ cookiecutter.js_task_runner}}".lower() == "none":
         remove_gulp_files()
         remove_packagejson_file()
-    if (
-        "{{ cookiecutter.js_task_runner }}".lower() != "none"
-        and "{{ cookiecutter.use_docker }}".lower() == "y"
-    ):
-        print(
-            WARNING
-            + "Docker and {} JS task runner ".format(
-                "{{ cookiecutter.js_task_runner }}".lower().capitalize()
-            )
-            + "working together not supported yet. "
-            "You can continue using the generated project like you "
-            "normally would, however you would need to add a JS "
-            "task runner service to your Docker Compose configuration "
-            "manually." + TERMINATOR
-        )
+        if "{{ cookiecutter.use_docker }}".lower() == "y":
+            remove_node_dockerfile()
 
     if "{{ cookiecutter.use_celery }}".lower() == "n":
         remove_celery_app()


Test patch:
Repository: cookiecutter/cookiecutter-django

Issue:
MediaRootS3BotoStorage causes issue with sorl-thumbnail
## What happened?

Broken thumbnail urls with Sorl. It ignores location parameter of `MediaRootS3BotoStorage` in [production settings](https://github.com/pydanny/cookiecutter-django/blob/ac61117b59e8aaf8a644501f432cb71e8e5df9a2/%7B%7Bcookiecutter.project_slug%7D%7D/config/settings/production.py#L102). Please see it here: https://stackoverflow.com/a/18046120/104731


## What should've happened instead?

Serializing & deserializing the storage class should retain the location parameter. Using a full fledge class instead of lambda resolves the issue.

```python
class MediaRootS3BotoStorage(S3Boto3Storage):
    location = 'media'
    file_overwrite = False
```


## Steps to reproduce

1. Create a new project with S3 bucket
2. Install and configure sorl-thumbnail
3. Try adding a couple of thumbnails to a template
4. Thumbnail url is broken. It ignores "/media/" part.


Discussion:
Thanks for the report. That indeed looks like a bug, feel free to send a pull request to fix it.

Resolving patch:
diff --git a/{{cookiecutter.project_slug}}/config/settings/production.py b/{{cookiecutter.project_slug}}/config/settings/production.py
--- a/{{cookiecutter.project_slug}}/config/settings/production.py
+++ b/{{cookiecutter.project_slug}}/config/settings/production.py
@@ -97,9 +97,19 @@
 MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/'
 {%- else %}
 # region http://stackoverflow.com/questions/10390244/
+# Full-fledge class: https://stackoverflow.com/a/18046120/104731
 from storages.backends.s3boto3 import S3Boto3Storage  # noqa E402
-StaticRootS3BotoStorage = lambda: S3Boto3Storage(location='static')  # noqa
-MediaRootS3BotoStorage = lambda: S3Boto3Storage(location='media', file_overwrite=False)  # noqa
+
+
+class StaticRootS3BotoStorage(S3Boto3Storage):
+    location = 'static'
+
+
+class MediaRootS3BotoStorage(S3Boto3Storage):
+    location = 'media'
+    file_overwrite = False
+
+
 # endregion
 DEFAULT_FILE_STORAGE = 'config.settings.production.MediaRootS3BotoStorage'
 MEDIA_URL = f'https://s3.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}/media/'


Test patch: