Skip to content
Commits on Source (3)
...@@ -9,3 +9,6 @@ linkshortner/ ...@@ -9,3 +9,6 @@ linkshortner/
├─ docker-compose.yml ├─ docker-compose.yml
├─ requirements.txt ├─ requirements.txt
└─ .env └─ .env
alias pm='python linkshortner manage.py'
alias dce='docker compose exec'
\ No newline at end of file
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
...@@ -10,6 +10,7 @@ For the full list of settings and their values, see ...@@ -10,6 +10,7 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.2/ref/settings/ https://docs.djangoproject.com/en/5.2/ref/settings/
""" """
import os import os
import dj_database_url
from pathlib import Path from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
...@@ -37,6 +38,7 @@ INSTALLED_APPS = [ ...@@ -37,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'core',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -73,10 +75,12 @@ WSGI_APPLICATION = 'linkshortner.wsgi.application' ...@@ -73,10 +75,12 @@ WSGI_APPLICATION = 'linkshortner.wsgi.application'
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases # https://docs.djangoproject.com/en/5.2/ref/settings/#databases
DATABASES = { DATABASES = {
'default': { "default": dj_database_url.parse(
'ENGINE': 'django.db.backends.sqlite3', os.environ.get("DATABASE_URL", ""), # vem do .env/Docker
'NAME': BASE_DIR / 'db.sqlite3', conn_max_age=600,
} ssl_require=False,
)
} }
......