change compose and create todo app

This commit is contained in:
rafa 2025-10-21 12:47:23 +01:00
parent fcc9a8602b
commit 039dcd98f5
12 changed files with 44 additions and 11 deletions

4
backend/.gitignore vendored
View File

@ -1,4 +1,6 @@
.venv/
.env
**/__pycache__/**
**/__pycache__/**
**/migrations/**

View File

@ -1,9 +1,15 @@
FROM python:3.13-bookworm
RUN useradd -m django
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
EXPOSE 8000
COPY . .
CMD ["python", "manage.py", "runserver" , "0.0.0.0:8000"]
COPY --chown=django . .
USER django:django
CMD ["python", "manage.py", "runserver" , "0.0.0.0:8000"]

View File

@ -37,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'todolist',
]
MIDDLEWARE = [

View File

@ -15,8 +15,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path("todolist/", include("todolist.urls")),
path('admin/', admin.site.urls),
]

View File

View File

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

6
backend/todolist/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class TodolistConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'todolist'

View File

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

View File

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

7
backend/todolist/urls.py Normal file
View File

@ -0,0 +1,7 @@
from django.urls import path
from . import views
urlpatterns = [
#path("", views.index, name="index"),
]

View File

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

View File

@ -19,11 +19,8 @@ services:
image: postgres
restart: unless-stopped
env_file: ./backend/.env
expose:
- 5432
volumes:
- db-data:/var/lib/postgresql
adminer:
image: adminer
restart: always
ports:
- 8080:8080
volumes:
db-data: