Add initial configuration and structure for the Twitch app, including models, views, and admin registration
This commit is contained in:
parent
31addca6de
commit
0c7c1c3f30
12 changed files with 76 additions and 83 deletions
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python Debugger: Django",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"args": [
|
||||||
|
"runserver"
|
||||||
|
],
|
||||||
|
"django": true,
|
||||||
|
"autoStartBrowser": false,
|
||||||
|
"program": "${workspaceFolder}\\manage.py"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -6,6 +6,8 @@
|
||||||
"appauthor",
|
"appauthor",
|
||||||
"appname",
|
"appname",
|
||||||
"ASGI",
|
"ASGI",
|
||||||
|
"collectstatic",
|
||||||
|
"createsuperuser",
|
||||||
"docstrings",
|
"docstrings",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"Hellsén",
|
"Hellsén",
|
||||||
|
|
@ -13,12 +15,14 @@
|
||||||
"Joakim",
|
"Joakim",
|
||||||
"lovinator",
|
"lovinator",
|
||||||
"Mailgun",
|
"Mailgun",
|
||||||
|
"makemigrations",
|
||||||
"platformdirs",
|
"platformdirs",
|
||||||
"psutil",
|
"psutil",
|
||||||
"pydocstyle",
|
"pydocstyle",
|
||||||
"pyright",
|
"pyright",
|
||||||
"pytest",
|
"pytest",
|
||||||
"regularuser",
|
"regularuser",
|
||||||
|
"runserver",
|
||||||
"sendgrid",
|
"sendgrid",
|
||||||
"testpass",
|
"testpass",
|
||||||
"ttvdrops",
|
"ttvdrops",
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -1,2 +1,14 @@
|
||||||
# ttvdrops
|
# ttvdrops
|
||||||
|
|
||||||
Get notified when a new drop is available on Twitch
|
Get notified when a new drop is available on Twitch
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
uv run python manage.py createsuperuser
|
||||||
|
uv run python manage.py makemigrations
|
||||||
|
uv run python manage.py migrate
|
||||||
|
uv run python manage.py collectstatic
|
||||||
|
uv run python manage.py runserver
|
||||||
|
uv run pytest
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
@ -8,6 +9,8 @@ from typing import Any
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from platformdirs import user_data_dir
|
from platformdirs import user_data_dir
|
||||||
|
|
||||||
|
logger: logging.Logger = logging.getLogger("ttvdrops.settings")
|
||||||
|
|
||||||
load_dotenv(verbose=True)
|
load_dotenv(verbose=True)
|
||||||
|
|
||||||
DEBUG: bool = os.getenv(key="DEBUG", default="True").lower() == "true"
|
DEBUG: bool = os.getenv(key="DEBUG", default="True").lower() == "true"
|
||||||
|
|
@ -43,6 +46,9 @@ BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
ROOT_URLCONF = "config.urls"
|
ROOT_URLCONF = "config.urls"
|
||||||
SECRET_KEY: str = os.getenv("DJANGO_SECRET_KEY", default="")
|
SECRET_KEY: str = os.getenv("DJANGO_SECRET_KEY", default="")
|
||||||
|
if not SECRET_KEY:
|
||||||
|
logger.error("DJANGO_SECRET_KEY environment variable is not set.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
DEFAULT_FROM_EMAIL: str | None = os.getenv(key="EMAIL_HOST_USER", default=None)
|
DEFAULT_FROM_EMAIL: str | None = os.getenv(key="EMAIL_HOST_USER", default=None)
|
||||||
EMAIL_HOST: str = os.getenv(key="EMAIL_HOST", default="smtp.gmail.com")
|
EMAIL_HOST: str = os.getenv(key="EMAIL_HOST", default="smtp.gmail.com")
|
||||||
|
|
@ -108,8 +114,8 @@ INSTALLED_APPS: list[str] = [
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
"django.contrib.messages",
|
"django.contrib.messages",
|
||||||
"django.contrib.staticfiles",
|
"django.contrib.staticfiles",
|
||||||
"django.contrib.sites",
|
"core.apps.CoreConfig",
|
||||||
"core",
|
"twitch.apps.TwitchConfig",
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE: list[str] = [
|
MIDDLEWARE: list[str] = [
|
||||||
|
|
|
||||||
|
|
@ -1,103 +1,44 @@
|
||||||
# Generated by Django 5.2.4 on 2025-07-08 00:33
|
# Generated by Django 5.2.4 on 2025-07-08 15:01
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
import django.contrib.auth.models
|
import django.contrib.auth.models
|
||||||
import django.contrib.auth.validators
|
import django.contrib.auth.validators
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from django.db.migrations.operations.base import Operation
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
"""Initial migration for the custom User model.
|
|
||||||
|
|
||||||
This migration creates the User model based on Django's AbstractUser.
|
|
||||||
"""
|
|
||||||
|
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies: list[tuple[str, str]] = [
|
dependencies = [
|
||||||
("auth", "0012_alter_user_first_name_max_length"),
|
('auth', '0012_alter_user_first_name_max_length'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations: list[Operation] = [
|
operations = [
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="User",
|
name='User',
|
||||||
fields=[
|
fields=[
|
||||||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
("password", models.CharField(max_length=128, verbose_name="password")),
|
('password', models.CharField(max_length=128, verbose_name='password')),
|
||||||
("last_login", models.DateTimeField(blank=True, null=True, verbose_name="last login")),
|
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
||||||
(
|
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
||||||
"is_superuser",
|
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
||||||
models.BooleanField(
|
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
|
||||||
default=False,
|
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
||||||
help_text="Designates that this user has all permissions without explicitly assigning them.",
|
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
||||||
verbose_name="superuser status",
|
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
||||||
),
|
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
||||||
),
|
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
||||||
(
|
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
|
||||||
"username",
|
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
|
||||||
models.CharField(
|
|
||||||
error_messages={"unique": "A user with that username already exists."},
|
|
||||||
help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
|
|
||||||
max_length=150,
|
|
||||||
unique=True,
|
|
||||||
validators=[django.contrib.auth.validators.UnicodeUsernameValidator()],
|
|
||||||
verbose_name="username",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("first_name", models.CharField(blank=True, max_length=150, verbose_name="first name")),
|
|
||||||
("last_name", models.CharField(blank=True, max_length=150, verbose_name="last name")),
|
|
||||||
("email", models.EmailField(blank=True, max_length=254, verbose_name="email address")),
|
|
||||||
(
|
|
||||||
"is_staff",
|
|
||||||
models.BooleanField(
|
|
||||||
default=False, help_text="Designates whether the user can log into this admin site.", verbose_name="staff status"
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"is_active",
|
|
||||||
models.BooleanField(
|
|
||||||
default=True,
|
|
||||||
help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
|
|
||||||
verbose_name="active",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("date_joined", models.DateTimeField(default=django.utils.timezone.now, verbose_name="date joined")),
|
|
||||||
(
|
|
||||||
"groups",
|
|
||||||
models.ManyToManyField(
|
|
||||||
blank=True,
|
|
||||||
help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.",
|
|
||||||
related_name="user_set",
|
|
||||||
related_query_name="user",
|
|
||||||
to="auth.group",
|
|
||||||
verbose_name="groups",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"user_permissions",
|
|
||||||
models.ManyToManyField(
|
|
||||||
blank=True,
|
|
||||||
help_text="Specific permissions for this user.",
|
|
||||||
related_name="user_set",
|
|
||||||
related_query_name="user",
|
|
||||||
to="auth.permission",
|
|
||||||
verbose_name="user permissions",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
"verbose_name": "User",
|
'verbose_name': 'User',
|
||||||
"verbose_name_plural": "Users",
|
'verbose_name_plural': 'Users',
|
||||||
"db_table": "auth_user",
|
'db_table': 'auth_user',
|
||||||
},
|
},
|
||||||
managers=[
|
managers=[
|
||||||
("objects", django.contrib.auth.models.UserManager()),
|
('objects', django.contrib.auth.models.UserManager()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
0
twitch/__init__.py
Normal file
0
twitch/__init__.py
Normal file
1
twitch/admin.py
Normal file
1
twitch/admin.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Register your models here.
|
||||||
10
twitch/apps.py
Normal file
10
twitch/apps.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class TwitchConfig(AppConfig):
|
||||||
|
"""AppConfig subclass for the 'twitch' application."""
|
||||||
|
|
||||||
|
default_auto_field: str = "django.db.models.BigAutoField"
|
||||||
|
name = "twitch"
|
||||||
0
twitch/migrations/__init__.py
Normal file
0
twitch/migrations/__init__.py
Normal file
1
twitch/models.py
Normal file
1
twitch/models.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Create your models here.
|
||||||
1
twitch/tests.py
Normal file
1
twitch/tests.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Create your tests here.
|
||||||
1
twitch/views.py
Normal file
1
twitch/views.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# Create your views here.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue