1
0
mirror of https://github.com/docker/awesome-compose.git synced 2025-07-01 01:52:54 +00:00
This commit is contained in:
Wes Lord 2024-12-21 16:31:12 -08:00 committed by GitHub
commit ef2ad8350b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 48 additions and 28 deletions

View File

@ -27,10 +27,10 @@ services:
$ docker compose up -d $ docker compose up -d
Creating network "django_default" with the default driver Creating network "django_default" with the default driver
Building web Building web
Step 1/6 : FROM python:3.7-alpine Step 1/6 : FROM python:3.12-alpine
... ...
... ...
Status: Downloaded newer image for python:3.7-alpine Status: Downloaded newer image for python:3.12-alpine
Creating django_web_1 ... done Creating django_web_1 ... done
``` ```

View File

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.4 # syntax=docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM python:3.7-alpine AS builder FROM --platform=$BUILDPLATFORM python:3.12-alpine AS builder
EXPOSE 8000 EXPOSE 8000
WORKDIR /app WORKDIR /app
COPY requirements.txt /app COPY requirements.txt /app

View File

@ -0,0 +1,16 @@
"""
ASGI config for example 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/4.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
application = get_asgi_application()

View File

@ -1,16 +1,16 @@
""" """
Django settings for example project. Django settings for example project.
Generated by 'django-admin startproject' using Django 1.11.22. Generated by 'django-admin startproject' using Django 4.2.17.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/ https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/ https://docs.djangoproject.com/en/4.2/ref/settings/
""" """
import os from pathlib import Path
from environs import Env from environs import Env
from dotenv import load_dotenv from dotenv import load_dotenv
@ -20,12 +20,12 @@ from dotenv import find_dotenv
env = Env() env = Env()
load_dotenv(find_dotenv()) load_dotenv(find_dotenv())
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY', SECRET_KEY = env('SECRET_KEY',
@ -80,18 +80,18 @@ WSGI_APPLICATION = 'example.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 'NAME': BASE_DIR / 'db.sqlite3',
} }
} }
# Password validation # Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
@ -110,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/ # https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = 'en-us'
@ -118,12 +118,15 @@ TIME_ZONE = 'UTC'
USE_I18N = True USE_I18N = True
USE_L10N = True
USE_TZ = True USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/ # https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = 'static/'
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

View File

@ -1,21 +1,22 @@
"""example URL Configuration """
URL configuration for example project.
The `urlpatterns` list routes URLs to views. For more information please see: The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/ https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples: Examples:
Function views Function views
1. Add an import: from my_app import views 1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') 2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views Class-based views
1. Add an import: from other_app.views import Home 1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.conf.urls import url
from django.contrib import admin from django.contrib import admin
from django.urls import path
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]

View File

@ -4,7 +4,7 @@ WSGI config for example project.
It exposes the WSGI callable as a module-level variable named ``application``. It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
""" """
import os import os

View File

@ -1,2 +1,2 @@
Django==3.2.13 Django~=4.2.17
environs==7.3.1 environs==7.3.1