Skip to content

Commit

Permalink
Merge branch 'update-django-to-5.1' into 'main'
Browse files Browse the repository at this point in the history
Update django to 5.1

See merge request divio/templates/getting-started-with-django!4
  • Loading branch information
Angelo Dini committed Aug 16, 2024
2 parents eed7835 + 851e5e0 commit 62c9505
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- "./data:/data:rw"
environment:
DATABASE_URL: postgres://postgres@database_default:5432/db
DEBUG: 'True'
links:
- "database_default"
# The following command is used to start the local development server.
Expand Down
4 changes: 2 additions & 2 deletions mysite/asgi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
ASGI config.
ASGI config for mysite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/
"""

import os
Expand Down
24 changes: 12 additions & 12 deletions mysite/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Django settings.
Django settings for mysite project.
Generated by 'django-admin startproject'.
Generated by 'django-admin startproject' using Django 5.1.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/topics/settings/
https://docs.djangoproject.com/en/5.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

import os
Expand All @@ -21,7 +21,7 @@


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY', 'changeme')
Expand Down Expand Up @@ -78,7 +78,7 @@


# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases

if "DATABASE_URL" in os.environ:
DATABASES = {'default': dj_database_url.config(conn_max_age=500)}
Expand All @@ -92,7 +92,7 @@


# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -111,7 +111,7 @@


# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/
# https://docs.djangoproject.com/en/5.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

Expand All @@ -123,7 +123,7 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
# https://docs.djangoproject.com/en/5.1/howto/static-files/

STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
Expand All @@ -143,7 +143,7 @@


# Default storage settings, with the staticfiles storage updated.
# See https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-STORAGES
# See https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-STORAGES
STORAGE_BACKEND = "django.core.files.storage.FileSystemStorage"

if AWS_SECRET_ACCESS_KEY:
Expand All @@ -155,14 +155,14 @@
},
# ManifestStaticFilesStorage is recommended in production, to prevent
# outdated JavaScript / CSS assets being served from cache
# See https://docs.djangoproject.com/en/5.0/ref/contrib/staticfiles/#manifeststaticfilesstorage
# See https://docs.djangoproject.com/en/5.1/ref/contrib/staticfiles/#manifeststaticfilesstorage
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.ManifestStaticFilesStorage",
},
}


# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
4 changes: 2 additions & 2 deletions mysite/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
URL configuration.
URL configuration for mysite project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.0/topics/http/urls/
https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
Expand Down
4 changes: 2 additions & 2 deletions mysite/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
WSGI config.
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
"""

import os
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=4.2,<5.1
Django>=5.1,<5.2
dj-database-url==2.2.0
psycopg[binary]>=3.1,<3.2
gunicorn>=22
Expand Down

0 comments on commit 62c9505

Please sign in to comment.