googlecodelabs / feedback

Provide feedback to our codelabs by filing an issue here
18 stars 22 forks source link

[cloud-run-djangocms]: ImportErrors on migrate or createuser from freshly built docker image #1428

Closed dreucifer closed 2 months ago

dreucifer commented 2 months ago

Trying to run migrate or create user gives me some import errors. The requirements.txt seems to be working and setting up the docker environment just fine but then...

"ImportError: cannot import name 'get_storage_class' from 'django.core.files.storage' (/layers/google.python.pip/pip/lib/python3.12/site-packages/django/core/files/storage/init.py)"

glasnt commented 2 months ago

Minimum replication steps:

python -m venv venv
source venv/bin/activate
pip install djangocms-frontend\[cms-3]
django-admin startproject --template https://github.com/django-cms/cms-template/archive/3.11.zip myproject .
python manage.py runserver

Issue: This codelab is pinned to Django CMS 3 (both the frontend package and template project), but the underlying Django is unpinned to Django 5, causing inconsistencies with older Django CMS code newer Django code (I believe there's a deprecation related issue here).

If you update the commands to use DjangoCMS 4, you no longer get this issue:

pip install djangocms-frontend\[cms-4]
django-admin startproject --template https://github.com/django-cms/cms-template/archive/4.1.zip myproject .

I'll update the codelab to suit.