Cookiecutter-django: Django 3.0 support

Created on 6 Dec 2019  ยท  14Comments  ยท  Source: pydanny/cookiecutter-django

Django 3.0 support?

when will django 3.0 be supported?

breaking help wanted

Most helpful comment

This is the start to organizing the packages, current versions in master, and which version of that package is 3.0 compatible.

When a package has been updated, we just need to add that version into the table.

That way when this PR is created, we can make sure the packages are all updated appropriately.

Link to Gist with the raw markdown

Base.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| django | 2.2.10 | 3.0 | โœ… |
| pytz | 2019.3 | x | โœ… |
|python-slugify| 4.0.0 | x | โœ… |
| Pillow | 7.0.0 | n/a | โœ… |
| rcssmin | 1.0.6 | n/a | โœ… |
|argon2-cffi | 19.2.0 | n/a | โœ… |
| whitenoise | 5.0.1 | 5.0 | โœ… |
| redis | 3.4.1 | n/a | โœ… |
| celery | 4.4.0 | n/a | โœ… |
| django-celery-beat | 2.0.0 | 2.0.0 | โœ… |
| flower | 0.9.3 | n/a | โœ… |
|django-environ | 0.4.5 | TODO | |
| django-model-utils | 4.0.0 | 4.0.0 | โœ… |
|django-allauth | 0.41.0 | on master, but not in official release yet | โœ… |
|django-crispy-forms| 1.8.1 | 1.8.0 | โœ… |
|django-compressor| 2.4 | 2.4 | โœ… |
|django-redis| 4.11.0 | 4.11.0| โœ… |
| djangorestframework | 3.11.0 | 3.11.0 | โœ… |
| coreapi | 2.3.3 | n/a | โœ… |

local.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| Werkzeug | 0.16.0 | n/a | โœ… |
| ipdb | 0.12.3 | n/a | โœ… |
| Sphinx | 2.3.0 | n/a | โœ… |
| psycopg2 | 2.8.4 | n/a | โœ… |
| psycopg2-binary |2.8.4 | n/a | โœ… |
| mypy | 0.761 | n/a | โœ… |
| pytest | 5.3.1 | n/a | โœ… |
|pytest-sugar | 0.9.2 | n/a | โœ… |
| flake8 | 3.7.9 | n/a | โœ… |
| coverage | 5.0.3 | n/a | โœ… |
| black | 19.10b0 | n/a | โœ… |
|pylint-django | 2.0.13 | n/a | โœ… |
| pylint-celery | 0.3 | n/a | โœ… |
| pre-commit | 1.20.0 | n/a | โœ… |
| factory-boy | 2.12.0 | In Master but not in official release yet | |
| django-debug-toolbar | 2.1 | 2.1 | โœ… |
| django-extensions |2.2.6 | 2.2.2 | โœ… |
| django-coverage-plugin | 1.8.0 | 1.7.0 | โœ… |
| pytest-django | 3.8.0 | 3.6.0 | โœ… |
| django-stubs | 1.4.0 | 1.3.0 | โœ… |

production.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| gunicorn | 20.0.4 | n/a | โœ… |
| psycopg2 | 2.8.3 | n/a | โœ… |
| Collectfast | 1.3.2 | 1.3.2 | โœ… |
| sentry-sdk | 0.13.5 | n/a | โœ… |
|django-storages[boto3] | 1.9 |1.8 | โœ… |
| django-storages[google] | 1.9 | 1.8 | โœ… |
| django-anymail[mailgun] | 7.0.0 | In Master but not in official release yet | |

All 14 comments

Support will be done sometime in the future, when all dependencies have updated support for Django 3.0.

Is there a list already of the packages and which have been updated? So we can keep track of which have been which need to be updated and their status.

I'm noticing many packages not in Cookiecutter are updated for 3.0 so it would be good to just have a simple table to keep track for this ticket.

Happy to put this together, but just want to make sure I'm not recreating something that already exists.

Good idea, such table would be very helpful indeed. I don't think anyone is doing it at the moment :+1:

@emilepetrone I am about to move to Django manually, but if you have that list please list them here to save up community time

This is the start to organizing the packages, current versions in master, and which version of that package is 3.0 compatible.

When a package has been updated, we just need to add that version into the table.

That way when this PR is created, we can make sure the packages are all updated appropriately.

Link to Gist with the raw markdown

Base.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| django | 2.2.10 | 3.0 | โœ… |
| pytz | 2019.3 | x | โœ… |
|python-slugify| 4.0.0 | x | โœ… |
| Pillow | 7.0.0 | n/a | โœ… |
| rcssmin | 1.0.6 | n/a | โœ… |
|argon2-cffi | 19.2.0 | n/a | โœ… |
| whitenoise | 5.0.1 | 5.0 | โœ… |
| redis | 3.4.1 | n/a | โœ… |
| celery | 4.4.0 | n/a | โœ… |
| django-celery-beat | 2.0.0 | 2.0.0 | โœ… |
| flower | 0.9.3 | n/a | โœ… |
|django-environ | 0.4.5 | TODO | |
| django-model-utils | 4.0.0 | 4.0.0 | โœ… |
|django-allauth | 0.41.0 | on master, but not in official release yet | โœ… |
|django-crispy-forms| 1.8.1 | 1.8.0 | โœ… |
|django-compressor| 2.4 | 2.4 | โœ… |
|django-redis| 4.11.0 | 4.11.0| โœ… |
| djangorestframework | 3.11.0 | 3.11.0 | โœ… |
| coreapi | 2.3.3 | n/a | โœ… |

local.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| Werkzeug | 0.16.0 | n/a | โœ… |
| ipdb | 0.12.3 | n/a | โœ… |
| Sphinx | 2.3.0 | n/a | โœ… |
| psycopg2 | 2.8.4 | n/a | โœ… |
| psycopg2-binary |2.8.4 | n/a | โœ… |
| mypy | 0.761 | n/a | โœ… |
| pytest | 5.3.1 | n/a | โœ… |
|pytest-sugar | 0.9.2 | n/a | โœ… |
| flake8 | 3.7.9 | n/a | โœ… |
| coverage | 5.0.3 | n/a | โœ… |
| black | 19.10b0 | n/a | โœ… |
|pylint-django | 2.0.13 | n/a | โœ… |
| pylint-celery | 0.3 | n/a | โœ… |
| pre-commit | 1.20.0 | n/a | โœ… |
| factory-boy | 2.12.0 | In Master but not in official release yet | |
| django-debug-toolbar | 2.1 | 2.1 | โœ… |
| django-extensions |2.2.6 | 2.2.2 | โœ… |
| django-coverage-plugin | 1.8.0 | 1.7.0 | โœ… |
| pytest-django | 3.8.0 | 3.6.0 | โœ… |
| django-stubs | 1.4.0 | 1.3.0 | โœ… |

production.txt

| Name | Version in Master | 3.0 Compatible Version | OK |
| ------------- |:-------------:| :-----:|:--:|
| gunicorn | 20.0.4 | n/a | โœ… |
| psycopg2 | 2.8.3 | n/a | โœ… |
| Collectfast | 1.3.2 | 1.3.2 | โœ… |
| sentry-sdk | 0.13.5 | n/a | โœ… |
|django-storages[boto3] | 1.9 |1.8 | โœ… |
| django-storages[google] | 1.9 | 1.8 | โœ… |
| django-anymail[mailgun] | 7.0.0 | In Master but not in official release yet | |

Besides Traefik, since Django 3.0 offers async, what service should be setup for Django's asgi for Docker? And should asgi be the default if we offer both Traefik and the asgi server?

@Andrew-Chen-Wang
Let me share my opinion. This is my use case with former Caddy and current Traefik.
(I omit celery others and their required containers for sake of simplicity here, but I always enable them in my compose.yml file)

  • 2 IPs point to single VM
  • Reverse Proxy configured to response between 2 containers

Next project my compose.yml would be like this

  • 3 IPs point to single VM
  • 1 container for wsgi
  • 1 container for Node server Vue, React, Angular, ... etc
  • 1 container for asgi. For django-channels
    In my dream I have 1 another PostGIS database, but unfortunately it is tremendous effort to put in down to Dockerfile I spent 3 days to get outdated version up and running

@elcolie Thanks for your setup! (just went through uvicorn's deployment doc with some benchmarks).

I found this https://www.uvicorn.org/#running-with-gunicorn, but I still stand on having asgi support in docker production be an optional thing rather than immediately implement gunicorn with uvicorn.

@emilepetrone Collectfast officially adds support for Django 3.0 in 1.3.2 released today.

django-environ looks dormant. I switched to environs, which has a very similar api (inspired by django-environ)

I tried to bump the Django version to see what was broken, and the build is now green, I've opened #2469

These are the libraries where support is not yet official:

  • django-environ: there is a pull request open which adds Django 3.0 to their CI config. Looking at the changes, I don't see any Django specific code changes, they seem mostly about dropping Python 2.
  • django-anymail: it's on master, and the changes to add it are mostly updating the CI config, which indicates the current version should work.
  • django-allauth: again, not officially supported but I was able to update their CI config and get a green build without any code changes.

We should be able to upgrade now, just need to test the generated production app works with various setup.

django-environ looks dormant. I switched to environs, which has a very similar api (inspired by django-environ)

We have -at least- 2 other issues for it: #2291 and #2195, I think we should consider it but it doesn't look like a blocker here.

Are we adding Uvicorn and the asgi file? This is what I've been following for playing around with web sockets on native Django 3.0:

https://dev.to/jaydenwindle/adding-websockets-to-your-django-app-with-no-extra-dependencies-2f6h

@Andrew-Chen-Wang
In my dream I have 1 another PostGIS database, but unfortunately it is tremendous effort to put in down to Dockerfile I spent 3 days to get outdated version up and running

I just swapped FROM postgres:11.3 with FROM postgis/postgis:11-2.5 and it didn't crash. Maybe your dream can come true! If you have a test app for PostGIS can you try it out and let me know? I spent an enormous amount of time as well, but looks like it's working with ubuntu/debian (don't go for alpine).

@wadkar I did get a postgis Docker configuration going by replacing the current postgres manually. Just make sure you include the required libraries in your Dockerfiles, i.e. GEOS, GDAL, PROJ.4 etc. You can use the Debian package website to look all of them up, too.

I also created a PR for the implementation of Uvicorn and Gunicorn at #2506. Also, you need to change the driver. You can do that by doing:

DATABASES["default"]["engine"] = 'django.contrib.gis.db.backends.postgis'

I also didn't use the alpine version as some thing could go wrong without some of the missing packages of Alpine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linuxluigi picture linuxluigi  ยท  3Comments

saschalalala picture saschalalala  ยท  4Comments

sebastian-code picture sebastian-code  ยท  4Comments

bluesurfer picture bluesurfer  ยท  4Comments

adammsteele picture adammsteele  ยท  3Comments