created links app and added to project

pull/3/head
Calum Andrew Morrell 2025-10-30 14:31:12 +00:00
parent 015980fc93
commit c24582b8b4
8 changed files with 75 additions and 55 deletions

View File

@ -9,6 +9,7 @@ https://docs.djangoproject.com/en/5.1/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/5.1/ref/settings/ https://docs.djangoproject.com/en/5.1/ref/settings/
""" """
import os import os
from pathlib import Path from pathlib import Path
@ -23,70 +24,71 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/5.1/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 = os.getenv('DJANGO_SECRET_KEY') SECRET_KEY = os.getenv("DJANGO_SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv('DEBUG') DEBUG = os.getenv("DEBUG")
ALLOWED_HOSTS = eval(os.getenv('ALLOWED_HOSTS')) ALLOWED_HOSTS = eval(os.getenv("ALLOWED_HOSTS"))
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'django.contrib.admin', "django.contrib.admin",
'django.contrib.auth', "django.contrib.auth",
'django.contrib.contenttypes', "django.contrib.contenttypes",
'django.contrib.sessions', "django.contrib.sessions",
'django.contrib.messages', "django.contrib.messages",
'django.contrib.staticfiles', "django.contrib.staticfiles",
'django.contrib.sites', "django.contrib.sites",
'django.contrib.flatpages', "django.contrib.flatpages",
'core.apps.CoreConfig', "core.apps.CoreConfig",
'articles.apps.ArticlesConfig', "articles.apps.ArticlesConfig",
'markdownx', "links.apps.LinksConfig",
"markdownx",
] ]
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', "django.middleware.security.SecurityMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware', "django.contrib.sessions.middleware.SessionMiddleware",
'django.middleware.common.CommonMiddleware', "django.middleware.common.CommonMiddleware",
'django.middleware.csrf.CsrfViewMiddleware', "django.middleware.csrf.CsrfViewMiddleware",
'django.contrib.auth.middleware.AuthenticationMiddleware', "django.contrib.auth.middleware.AuthenticationMiddleware",
'django.contrib.messages.middleware.MessageMiddleware', "django.contrib.messages.middleware.MessageMiddleware",
'django.middleware.clickjacking.XFrameOptionsMiddleware', "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = 'config.urls' ROOT_URLCONF = "config.urls"
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', "BACKEND": "django.template.backends.django.DjangoTemplates",
'DIRS': [BASE_DIR / 'templates'], "DIRS": [BASE_DIR / "templates"],
'APP_DIRS': True, "APP_DIRS": True,
'OPTIONS': { "OPTIONS": {
'context_processors': [ "context_processors": [
'django.template.context_processors.debug', "django.template.context_processors.debug",
'django.template.context_processors.request', "django.template.context_processors.request",
'django.contrib.auth.context_processors.auth', "django.contrib.auth.context_processors.auth",
'django.contrib.messages.context_processors.messages', "django.contrib.messages.context_processors.messages",
], ],
}, },
}, },
] ]
WSGI_APPLICATION = 'config.wsgi.application' WSGI_APPLICATION = "config.wsgi.application"
# Database # Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases # https://docs.djangoproject.com/en/5.1/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.postgresql', "ENGINE": "django.db.backends.postgresql",
'NAME': os.getenv('DB_NAME'), "NAME": os.getenv("DB_NAME"),
'USER': os.getenv('DB_USER'), "USER": os.getenv("DB_USER"),
'PASSWORD': os.getenv('DB_PASSWORD'), "PASSWORD": os.getenv("DB_PASSWORD"),
'HOST': os.getenv('DB_HOST'), "HOST": os.getenv("DB_HOST"),
'PORT': os.getenv('DB_PORT'), "PORT": os.getenv("DB_PORT"),
} }
} }
@ -95,25 +97,25 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
}, },
{ {
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
}, },
] ]
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/ # https://docs.djangoproject.com/en/5.1/topics/i18n/
LANGUAGE_CODE = 'en-gb' LANGUAGE_CODE = "en-gb"
TIME_ZONE = 'UTC' TIME_ZONE = "UTC"
USE_I18N = True USE_I18N = True
@ -122,10 +124,10 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/ # https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = 'static/' STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / 'static/' STATIC_ROOT = BASE_DIR / "static/"
MEDIA_URL = 'media/' MEDIA_URL = "media/"
MEDIA_ROOT = BASE_DIR / 'media/' MEDIA_ROOT = BASE_DIR / "media/"
# Site id to allow flatpages to function correctly # Site id to allow flatpages to function correctly
SITE_ID = 1 SITE_ID = 1
@ -145,18 +147,18 @@ SITE_ID = 1
# Tagulous config # Tagulous config
SERIALIZATION_MODULES = { SERIALIZATION_MODULES = {
'xml': 'tagulous.serializers.xml_serializer', "xml": "tagulous.serializers.xml_serializer",
'json': 'tagulous.serializers.json', "json": "tagulous.serializers.json",
'python': 'tagulous.serializers.python', "python": "tagulous.serializers.python",
'yaml': 'tagulous.serializers.pyyaml', "yaml": "tagulous.serializers.pyyaml",
} }
# Markdownx config # Markdownx config
MARKDOWNX_MARKDOWN_EXTENSIONS = [ MARKDOWNX_MARKDOWN_EXTENSIONS = [
'markdown.extensions.extra', "markdown.extensions.extra",
] ]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

0
links/__init__.py Normal file
View File

3
links/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
links/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class LinksConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "links"

View File

3
links/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
links/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
links/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.