change compose and create todo app
This commit is contained in:
parent
fcc9a8602b
commit
039dcd98f5
4
backend/.gitignore
vendored
4
backend/.gitignore
vendored
@ -1,4 +1,6 @@
|
|||||||
.venv/
|
.venv/
|
||||||
.env
|
.env
|
||||||
|
|
||||||
**/__pycache__/**
|
**/__pycache__/**
|
||||||
|
|
||||||
|
**/migrations/**
|
||||||
@ -1,9 +1,15 @@
|
|||||||
|
|
||||||
FROM python:3.13-bookworm
|
FROM python:3.13-bookworm
|
||||||
|
|
||||||
|
RUN useradd -m django
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY requirements.txt requirements.txt
|
COPY requirements.txt requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
COPY . .
|
COPY --chown=django . .
|
||||||
CMD ["python", "manage.py", "runserver" , "0.0.0.0:8000"]
|
|
||||||
|
USER django:django
|
||||||
|
|
||||||
|
CMD ["python", "manage.py", "runserver" , "0.0.0.0:8000"]
|
||||||
|
|||||||
@ -37,6 +37,8 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
|
|
||||||
|
'todolist',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|||||||
@ -15,8 +15,9 @@ Including another URLconf
|
|||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path
|
from django.urls import path, include
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path("todolist/", include("todolist.urls")),
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|||||||
0
backend/todolist/__init__.py
Normal file
0
backend/todolist/__init__.py
Normal file
3
backend/todolist/admin.py
Normal file
3
backend/todolist/admin.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
6
backend/todolist/apps.py
Normal file
6
backend/todolist/apps.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class TodolistConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'todolist'
|
||||||
3
backend/todolist/models.py
Normal file
3
backend/todolist/models.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
3
backend/todolist/tests.py
Normal file
3
backend/todolist/tests.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
7
backend/todolist/urls.py
Normal file
7
backend/todolist/urls.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from django.urls import path
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
#path("", views.index, name="index"),
|
||||||
|
]
|
||||||
3
backend/todolist/views.py
Normal file
3
backend/todolist/views.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
11
compose.yaml
11
compose.yaml
@ -19,11 +19,8 @@ services:
|
|||||||
image: postgres
|
image: postgres
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: ./backend/.env
|
env_file: ./backend/.env
|
||||||
expose:
|
volumes:
|
||||||
- 5432
|
- db-data:/var/lib/postgresql
|
||||||
|
|
||||||
adminer:
|
volumes:
|
||||||
image: adminer
|
db-data:
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- 8080:8080
|
|
||||||
Loading…
x
Reference in New Issue
Block a user