8000 django upgrade from 4.2 to 5.0 · github/codespaces-django@72502ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 72502ec

Browse files
django upgrade from 4.2 to 5.0
1 parent 7cb6704 commit 72502ec

File tree

7 files changed

+36
-22
lines changed

7 files changed

+36
-22
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ Welcome to your shiny new Codespace running Django! We've got everything fired u
55
You've got a blank canvas to work on from a git perspective as well. There's a single initial commit with what you're seeing right now - where you go from here is up to you!
66

77
Everything you do here is contained within this one codespace. There is no repository on GitHub yet. If and when you’re ready you can click "Publish Branch" and we’ll create your repository and push up your project. If you were just exploring then and have no further need for this code then you can simply delete your codespace and it's gone forever.
8+
9+
## installing dependancies
10+
11+
```python
12+
pip install -r requirements.txt
13+
```
14+
815
To collect static files:
916

1017
```python

hello_world/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the ASGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
7+
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
88
"""
99

1010
import os

hello_world/settings.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
"""
22
Django settings for hello_world project.
33
4-
Generated by 'django-admin startproject' using Django 4.2.11.
4+
Generated by 'django-admin startproject' using Django 5.0.4.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/topics/settings/
7+
https://docs.djangoproject.com/en/5.0/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/4.2/ref/settings/
10+
https://docs.djangoproject.com/en/5.0/topics/settings/
1111
"""
1212

1313
import os
1414
from pathlib import Path
15-
from dotenv import load_dotenv
16-
17-
load_dotenv()
15+
from decouple import config
1816

1917
# Build paths inside the project like this: BASE_DIR / 'subdir'.
2018
BASE_DIR = Path(__file__).resolve().parent.parent
2119

2220

2321
# Quick-start development settings - unsuitable for production
24-
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
22+
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
2523

2624
# SECURITY WARNING: keep the secret key used in production secret!
27-
SECRET_KEY = os.getenv("SECRET_KEY")
25+
SECRET_KEY = config("SECRET_KEY")
2826

2927
# SECURITY WARNING: don't run with debug turned on in production!
30-
DEBUG = os.getenv("DEBUG")
28+
DEBUG = config("DEBUG")
3129

32-
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')
30+
ALLOWED_HOSTS = config('ALLOWED_HOSTS', '').split(',')
3331

3432
if 'CODESPACE_NAME' in os.environ:
35-
codespace_name = os.getenv("CODESPACE_NAME")
36-
codespace_domain = os.getenv("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN")
33+
codespace_name = config("CODESPACE_NAME")
34+
codespace_domain = config("GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN")
3735
CSRF_TRUSTED_ORIGINS = [f'https://{codespace_name}-8000.{codespace_domain}']
3836

3937
# Application definition
@@ -83,7 +81,7 @@
8381

8482

8583
# Database
86-
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
84+
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
8785

8886
DATABASES = {
8987
"default": {
@@ -113,7 +111,7 @@
113111

114112

115113
# Internationalization
116-
# https://docs.djangoproject.com/en/4.2/topics/i18n/
114+
# https://docs.djangoproject.com/en/5.0/topics/i18n/
117115

118116
LANGUAGE_CODE = "en-us"
119117

@@ -125,7 +123,7 @@
125123

126124

127125
# Static files (CSS, JavaScript, Images)
128-
# https://docs.djangoproject.com/en/4.2/howto/static-files/
126+
# https://docs.djangoproject.com/en/5.0/howto/static-files/
129127

130128
STATICFILES_DIRS = [
131129
BASE_DIR / "hello_world" / "static",
@@ -139,6 +137,6 @@
139137

140138

141139
# Default primary key field type
142-
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
140+
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
143141

144142
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

hello_world/templates/index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
<html lang="en">
66

77
<head>
8-
<title>{{ title }}</title>
8+
<meta charset="utf-8">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
<meta name="description" content="GitHub Codespaces ♥️ Django">
11+
<meta name="author" content="GitHub Codespaces">
12+
<meta name="generator" content="GitHub Codespaces">
13+
<meta name="theme-color" content="#000000">
14+
<title>{% block title %}{{ title }} | GitHub Codespaces ♥️ Django{% endblock %}</title>
15+
916
<link rel="stylesheet" href="{% static 'main.css' %}">
1017
</head>
1118

hello_world/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
URL configuration for hello_world project.
33
44
The `urlpatterns` list routes URLs to views. For more information please see:
5-
https://docs.djangoproject.com/en/4.2/topics/http/urls/
5+
https://docs.djangoproject.com/en/5.0/topics/http/urls/
66
Examples:
77
Function views
88
1. Add an import: from my_app import views

hello_world/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
88
"""
99

1010
import os

requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
Django==4.2.11
1+
asgiref==3.8.1
2+
Django==5.0.4
23
django-browser-reload==1.12.1
3-
python-dotenv==1.0.1
4+
python-decouple==3.8
5+
sqlparse==0.5.0

0 commit comments

Comments
 (0)
0