Skip to content
Commits on Source (3)
......@@ -9,3 +9,6 @@ linkshortner/
├─ docker-compose.yml
├─ requirements.txt
└─ .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
https://docs.djangoproject.com/en/5.2/ref/settings/
"""
import os
import dj_database_url
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
......@@ -37,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'core',
]
MIDDLEWARE = [
......@@ -73,10 +75,12 @@ WSGI_APPLICATION = 'linkshortner.wsgi.application'
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
"default": dj_database_url.parse(
os.environ.get("DATABASE_URL", ""), # vem do .env/Docker
conn_max_age=600,
ssl_require=False,
)
}
......