Skip to content

Update Django to 4.2 and Python to 3.9 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stripathi669
Copy link
Contributor

This update brings the application to a more modern stack with Long-Term Support (LTS) versions of Django and a recent Python version.

Key changes include:

  • Upgraded Django from 1.11 to 4.2.x in requirements.txt.
  • Replaced django-celery with the modern celery[django] package (Celery 5.3.x).
  • Updated various dependencies in requirements.txt for compatibility.
  • Specified Python 3.9 for the Elastic Beanstalk environment via a runtime.txt file.
  • Addressed compatibility issues in Django settings:
    • Updated Celery configuration (CELERY_RESULT_BACKEND, CELERY_BEAT_SCHEDULER).
    • Added django_celery_beat and django_celery_results to INSTALLED_APPS.
  • Updated urls.py to use re_path instead of url.
  • Updated Celery app initialization in _celery.py and __init__.py.
  • Made the createsu management command in Elastic Beanstalk configuration (.ebextensions/03_django.config) more robust by allowing it to fail without stopping deployment (e.g., if superuser already exists).
  • Added basic unit tests:
    • Test for admin login page accessibility.
    • Tests for Celery task import, callability, and basic execution.

The awsebcli and some of its direct dependencies were kept at older versions due to difficulties in upgrading them alongside other changes. Further work may be needed to modernize those if required.

This update brings the application to a more modern stack with Long-Term Support (LTS) versions of Django and a recent Python version.

Key changes include:
- Upgraded Django from 1.11 to 4.2.x in `requirements.txt`.
- Replaced `django-celery` with the modern `celery[django]` package (Celery 5.3.x).
- Updated various dependencies in `requirements.txt` for compatibility.
- Specified Python 3.9 for the Elastic Beanstalk environment via a `runtime.txt` file.
- Addressed compatibility issues in Django settings:
    - Updated Celery configuration (`CELERY_RESULT_BACKEND`, `CELERY_BEAT_SCHEDULER`).
    - Added `django_celery_beat` and `django_celery_results` to `INSTALLED_APPS`.
- Updated `urls.py` to use `re_path` instead of `url`.
- Updated Celery app initialization in `_celery.py` and `__init__.py`.
- Made the `createsu` management command in Elastic Beanstalk configuration (`.ebextensions/03_django.config`) more robust by allowing it to fail without stopping deployment (e.g., if superuser already exists).
- Added basic unit tests:
    - Test for admin login page accessibility.
    - Tests for Celery task import, callability, and basic execution.

The `awsebcli` and some of its direct dependencies were kept at older versions due to difficulties in upgrading them alongside other changes. Further work may be needed to modernize those if required.
@@ -8,5 +8,5 @@ container_commands:
command: "python manage.py collectstatic --noinput"
leader_only: true
02_createsu:
command: "manage.py createsu"
command: "python manage.py createsu || true"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't change this

@@ -0,0 +1,65 @@
from django.test import TestCase, Client
from django.urls import reverse
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove test file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant