official-documentation-samples/django does not run due to Python version mismatch #118

Open
opened 2025-11-06 14:19:08 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @weslord on GitHub (Dec 21, 2024).

Following the instructions in Quickstart: Compose and Django causes the app to crash with an error:

 Container django-docker-db-1  Running
Traceback (most recent call last):
  File "/usr/local/bin/django-admin", line 8, in <module>
    sys.exit(execute_from_command_line())
             ~~~~~~~~~~~~~~~~~~~~~~~~~^^

  [...lines removed for readability...]

  File "/usr/local/lib/python3.13/site-packages/django/core/management/templates.py", line 1, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'

cgi was removed in the latest version of Python.

The example restricts Django to version 3.2:

Django>=3.0,<4.0

But uses the latest version of Python (incompatible with Django 3.2):

FROM python:3
Originally created by @weslord on GitHub (Dec 21, 2024). Following the instructions in [Quickstart: Compose and Django](https://github.com/docker/awesome-compose/blob/master/official-documentation-samples/django/README.md) causes the app to crash with an error: ``` Container django-docker-db-1 Running Traceback (most recent call last): File "/usr/local/bin/django-admin", line 8, in <module> sys.exit(execute_from_command_line()) ~~~~~~~~~~~~~~~~~~~~~~~~~^^ [...lines removed for readability...] File "/usr/local/lib/python3.13/site-packages/django/core/management/templates.py", line 1, in <module> import cgi ModuleNotFoundError: No module named 'cgi' ``` `cgi` was removed in the latest version of Python. The example restricts Django to version 3.2: ``` Django>=3.0,<4.0 ``` But uses the latest version of Python (incompatible with Django 3.2): ``` FROM python:3 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-compose#118