Skip to content

Commit

Permalink
Upgraded to Django 5.1.6 version
Browse files Browse the repository at this point in the history
  • Loading branch information
macagua committed Feb 11, 2025
1 parent abfdea4 commit aed62f8
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 34 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
*.pyo
build/
dist/
helloworld.db
*.db
*.sqlite3
local_settings.py
22 changes: 14 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,28 @@ the following command:

::

$ sudo apt update
$ sudo apt update && sudo apt upgrade

Install necessary minimum dependencies, with the following command:

::

$ sudo apt install python3-dev python3-pip python3-virtualenv sqlitebrowser
$ sudo apt install python3-dev python3-pip python3-virtualenv

For run this example need to install Django framework
executing the follow command:

::

$ sudo pip install -r requirements.txt
$ sudo pip3 install -r requirements.txt

And later to test the Django Installation is done with the following command:

::

$ python -m django --version
5.1.6

And later followed by:

::

Expand All @@ -40,9 +46,8 @@ At which point you should see:
::

Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions, sites
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:

Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Expand All @@ -57,9 +62,10 @@ At which point you should see:
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying sessions.0001_initial... OK
Applying sites.0001_initial... OK
Applying sites.0002_alter_domain_unique... OK


For use the Django Admin Interface, it's needed to create a superuser
Expand Down
Binary file modified docs/django_admin_interface_running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/django_helloword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions helloworld/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for helloworld 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.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')

application = get_asgi_application()
41 changes: 23 additions & 18 deletions helloworld/settings.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
"""
Django settings for helloworld project.
Generated by 'django-admin startproject' using Django 2.2.3.
Generated by 'django-admin startproject' using Django 5.1.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/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/2.2/ref/settings/
https://docs.djangoproject.com/en/5.1/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/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 = 'matxp6k!wbkmdlk)97)ew2qr%&9nr=n#v_-+v#yel4^r&czf7q'
SECRET_KEY = 'django-insecure-sokpy*q9_=6j-9mrh_l)*k+&im(xfbxz_8=&u536n@9s)9&*gv'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down Expand Up @@ -72,18 +72,18 @@


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

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'helloworld.db'),
'NAME': BASE_DIR / 'helloworld.sqlite3',
}
}


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

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


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

LANGUAGE_CODE = 'en-us'

Expand All @@ -112,14 +112,19 @@
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True


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

STATIC_URL = 'static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]

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

STATIC_URL = '/static/'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
5 changes: 3 additions & 2 deletions helloworld/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""helloworld URL Configuration
"""
URL configuration for helloworld project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/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
2 changes: 1 addition & 1 deletion helloworld/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/
"""

import os
Expand Down
1 change: 1 addition & 0 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
try:
from django.core.management import execute_from_command_line
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# requirements.txt file
Django==4.2.18
Django==5.1.6
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Indicate supported versions, Python 2, Python 3 or both.
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Software Development",
Expand All @@ -30,7 +30,7 @@ def read(fname):

setup(
name="django-helloworld",
version="0.1",
version="0.2",
description="A Django 'Hello World' program example",
long_description=read('README.rst'),
classifiers=CLASSIFIERS,
Expand All @@ -42,7 +42,7 @@ def read(fname):
url="https://github.com/django-ve/django-helloworld",
license="GPL",
platforms="OS Independent",
install_requires=["Django==4.2.18"],
install_requires=["Django==5.1.6"],
packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
include_package_data=True,
zip_safe=False,
Expand Down
Binary file added static/favicon.ico
Binary file not shown.

0 comments on commit aed62f8

Please sign in to comment.