Repository: cookiecutter/cookiecutter-django

Issue:
[Update Django] Django 4.0
4.0 requirements tables



## base.txt

| Name | Version in Master | 4.0 Compatible Version | OK |
| ---- | :---------------: | :-----------------------------: | :-: |
| [pytz](http://pythonhosted.org/pytz) | 2022.4 | n/a | ✅ |
| [python-slugify](https://github.com/un33k/python-slugify) | 6.1.2 | n/a | ✅ |
| [Pillow](https://python-pillow.org) | 9.2.0 | n/a | ✅ |
| [rcssmin](http://opensource.perlig.de/rcssmin/) | 1.1.0 | n/a | ✅ |
| [argon2-cffi](https://pypi.org/project/argon2-cffi/) | 21.3.0 | n/a | ✅ |
| [whitenoise](https://github.com/evansd/whitenoise) | 6.2.0 | 6.0.0 | ✅ |
| [redis](https://github.com/redis/redis-py) | 4.3.4 | n/a | ✅ |
| [hiredis](https://github.com/redis/hiredis-py) | 2.0.0 | n/a | ✅ |
| [celery](http://celeryproject.org) | 5.2.7 | n/a | ✅ |
| [django-celery-beat](https://github.com/celery/django-celery-beat) | 2.3.0 |  | ✅ |
| [flower](https://github.com/mher/flower) | 1.2.0 | n/a | ✅ |
| [uvicorn](https://pypi.org/project/uvicorn/) | 0.18.3 | n/a | ✅ |
| [django](https://www.djangoproject.com/) | 3.2.16 |  | ✅ |
| [django-environ](https://django-environ.readthedocs.org) | 0.9.0 |  | ❓ |
| [django-model-utils](https://github.com/jazzband/django-model-utils) | 4.2.0 | 4.2.0 | ✅ |
| [django-allauth](http://www.intenct.nl/projects/django-allauth/) | 0.51.0 | 0.47.0 | ✅ |
| [django-crispy-forms](https://github.com/django-crispy-forms/django-crispy-forms) | 1.14.0 | 1.13.0 | ✅ |
| [crispy-bootstrap5](https://github.com/django-crispy-forms/crispy-bootstrap5) | 0.6 | 0.6 | ✅ |
| [django-compressor](https://django-compressor.readthedocs.io/en/latest/) | 4.1 | n/a | ✅ |
| [django-redis](https://github.com/jazzband/django-redis) | 5.2.0 | 5.2.0 | ✅ |
| [djangorestframework](https://www.django-rest-framework.org/) | 3.14.0 | 3.13.0 | ✅ |
| [django-cors-headers](https://github.com/adamchainz/django-cors-headers) | 3.13.0 | 3.10.1 | ✅ |
| [drf-spectacular](https://github.com/tfranzel/drf-spectacular) | 0.24.2 | 0.22.0 | ✅ |


## local.txt

| Name | Version in Master | 4.0 Compatible Version | OK |
| ---- | :---------------: | :-----------------------------: | :-: |
| [Werkzeug](https://palletsprojects.com/p/werkzeug/) | 2.2.2 | n/a | ✅ |
| [ipdb](https://github.com/gotcha/ipdb) | 0.13.9 | n/a | ✅ |
| [psycopg2](https://psycopg.org/) | 2.9.4 | n/a | ✅ |
| [psycopg2-binary](https://psycopg.org/) | 2.9.4 | n/a | ✅ |
| [watchfiles](https://pypi.org/project/watchfiles/) | 0.17.0 | n/a | ✅ |
| [mypy](http://www.mypy-lang.org/) | 0.982 | n/a | ✅ |
| [django-stubs](https://github.com/typeddjango/django-stubs) | 1.12.0 | 1.12.0 | ✅ |
| [pytest](https://docs.pytest.org/en/latest/) | 7.1.3 | n/a | ✅ |
| [pytest-sugar](https://pivotfinland.com/pytest-sugar/) | 0.9.5 | n/a | ✅ |
| [djangorestframework-stubs](https://github.com/typeddjango/djangorestframework-stubs) | 1.7.0 | n/a | ✅ |
| [sphinx](https://pypi.org/project/Sphinx/) | 5.2.3 | n/a | ✅ |
| [sphinx-autobuild](https://github.com/executablebooks/sphinx-autobuild) | 2021.3.14 | n/a | ✅ |
| [flake8](https://github.com/pycqa/flake8) | 5.0.4 | n/a | ✅ |
| [flake8-isort](https://github.com/gforcada/flake8-isort) | 5.0.0 | n/a | ✅ |
| [coverage](https://github.com/nedbat/coveragepy) | 6.5.0 | n/a | ✅ |
| [black](https://pypi.org/project/black/) | 22.10.0 | n/a | ✅ |
| [pylint-django](https://github.com/PyCQA/pylint-django) | 2.5.3 |  | ❓ |
| [pylint-celery](https://github.com/landscapeio/pylint-celery) | 0.3 | n/a | ✅ |
| [pre-commit](https://github.com/pre-commit/pre-commit) | 2.20.0 | n/a | ✅ |
| [factory-boy](https://github.com/FactoryBoy/factory_boy) | 3.2.1 |  | ✅ |
| [django-debug-toolbar](https://github.com/jazzband/django-debug-toolbar) | 3.7.0 | 3.2.4 | ✅ |
| [django-extensions](http://github.com/django-extensions/django-extensions) | 3.2.1 | 3.2.0 | ✅ |
| [django-coverage-plugin](https://github.com/nedbat/django_coverage_plugin) | 2.0.3 |  | ✅ |
| [pytest-django](https://pytest-django.readthedocs.io/) | 4.5.2 | 4.5.2 | ✅ |


## production.txt

| Name | Version in Master | 4.0 Compatible Version | OK |
| ---- | :---------------: | :-----------------------------: | :-: |
| [gunicorn](https://gunicorn.org) | 20.1.0 | n/a | ✅ |
| [psycopg2](https://psycopg.org/) | 2.9.4 | n/a | ✅ |
| [Collectfast](https://github.com/antonagestam/collectfast/) | 2.2.0 | n/a | ✅ |
| [sentry-sdk](https://github.com/getsentry/sentry-python) | 1.9.10 | n/a | ✅ |
| [hiredis](https://github.com/redis/hiredis-py) | 2.0.0 | n/a | ✅ |
| [django-storages](https://github.com/jschneier/django-storages) | 1.13.1 | 1.13 | ✅ |
| [django-anymail](https://github.com/anymail/django-anymail) | 8.6 | 8.5 | ✅ |



Discussion:
Hello Bruno @browniebroke ,
I'm a student, currently completing my Undergraduate course in Computer Engineering. I have some experience in Django and python.
I think I can help you out in the issue you are facing, so i would request you to assign this issue to me and give me a bit detailed information about the issue.



@CodeOnnnn this is an automated script that checks if the packages support the specified Django version. Nothing needs to be done here, but feel free to visit other issues or check out the repositories above and help contribute to their efforts! Help is needed in Django's asgiref specifically `asgiref.sync` contextvars refactoring if you'd like to help there!
@browniebroke there seems to be a bug in base.txt? X mark underneath drf spectacular. Are we adding an unnecessary vertical bar?
There is a bug in the script when we introduce a new dependency, it crashes in the middle because it cannot find the existing version.

It started breaking when DRF-spectacular was introduced, so I've added it manually and might have misformatted something.

Ideally we should have new deps handled automatically by the django updater script. I'd be keen to get a few unit tests for the various functions to make it more maintainable. 
Hey guys, thanks for the awesome effort.

Not sure if my question is in the right place, but:

Is there a recommendation to use the current build with Django 4.0, or it's just go vanilla django until this is closed?

I'm manually disabling the packages not supporting Django 4 (If they really don't/causes conflicts) from requirements.txt -- would that be enough?
I mean you can look at the current requirements above. So for example in production.txt django storages is not supporting django 4.0 yet but if you don't need django storages then you could update django so it's up to you
Looks like the main blocker are actually https://github.com/django-extensions/django-extensions/pull/1698 and django-stubs. 

As far as I can tell, the others which are marked as incompatible have a PR open without any application code change.
> I mean you can look at the current requirements above. So for example in production.txt django storages is not supporting django 4.0 yet but if you don't need django storages then you could update django so it's up to you

Yes, they only didn't update tests or adding support version only in readthedocs - but it works normally, tested it with GCP. I was concerned if Cookiecutter Django it self might have core changes.


> Looks like the main blocker are actually [django-extensions/django-extensions#1698](https://github.com/django-extensions/django-extensions/pull/1698) and django-stubs.
> 
> As far as I can tell, the others which are marked as incompatible have a PR open without any application code change.

Awesome! Thanks a lot.
Looks like https://github.com/django-extensions/django-extensions/pull/1698 has been merged but has not been released, and some users report https://github.com/typeddjango/django-stubs/issues/808 working with 4.0.

django-storages has added 4.0 to tests, but no idea on compatibility at this stage https://github.com/jschneier/django-storages/issues/1092
Storages has released 4.0 and 4.1 support
I think it's party time. Let's upgrade to 4.0 pleaseeeee
cc @browniebroke
Finally got around to do some smoke tests with django-storages. Anyone up to do the upgrade and send a pull request?

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,7 @@
     classifiers=[
         "Development Status :: 4 - Beta",
         "Environment :: Console",
-        "Framework :: Django :: 3.2",
+        "Framework :: Django :: 4.0",
         "Intended Audience :: Developers",
         "Natural Language :: English",
         "License :: OSI Approved :: BSD License",
diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/migrations/0001_initial.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/migrations/0001_initial.py
--- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/migrations/0001_initial.py
+++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/migrations/0001_initial.py
@@ -1,4 +1,3 @@
-# Generated by Django 3.2.9 on 2021-11-20 11:23
 import django.contrib.auth.models
 import django.contrib.auth.validators
 from django.db import migrations, models


Test patch: