docker: implementanto postgresql no docker-compose

This commit is contained in:
2025-04-14 17:02:47 -03:00
parent 44cfa49455
commit 0a47948aea
10 changed files with 115 additions and 72 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@ dev_env/lib/python3.12/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-
dev_env
dev_home
gestaoRaul/static
.env

View File

@@ -1,26 +1,36 @@
#version: '3.8'
services:
db:
image: postgres:15
volumes:
- db_data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: ${DATABASE_NAME:-gestaoraul_db}
POSTGRES_USER: ${DATABASE_USER:-postgres}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-postgres}
ports:
- "5432:5432"
networks:
- app_network
django_app:
build:
context: ./ #django_app # Caminho para o Dockerfile da sua aplicação Django
context: ./
dockerfile: Dockerfile
ports:
- "8000:8000"
volumes:
- static_volume:/app/gestaoRaul/static # Volume para persistir os arquivos estáticos (opcional)
- static_volume:/app/gestaoRaul/static
environment:
# Suas variáveis de ambiente do Django
DEBUG: "False"
ALLOWED_HOSTS: "rrbec.local.com, 0.0.0.0, django_app*" # Adicione seu nome de domínio
# depends_on:
# - nginx_server
ALLOWED_HOSTS: "rrbec.local.com, 0.0.0.0, django_app*"
networks:
- app_network
nginx_server:
build:
context: ./NginxServer # Caminho para a pasta com o Dockerfile do Nginx e nginx.conf
context: ./NginxServer
dockerfile: Dockerfile
volumes:
- static_volume:/app/gestaoRaul/static
@@ -32,7 +42,8 @@ services:
- app_network
volumes:
static_volume: # Define o volume para os arquivos estáticos
static_volume:
db_data:
networks:
app_network:

View File

@@ -74,7 +74,7 @@ class CreateComandaViewTest(TestCase):
wrapped_view = group_required(groupName='Garçom')(createComanda)
response = wrapped_view(request)
self.assertEqual(response.status_code, 302) # Deve redirecionar para a página de login (padrão do Django)
self.assertEqual(response.status_code, 302) # Deve redirecionar para a página de login
self.assertTrue(response.url.startswith(reverse('login'))) # Verifica se redireciona para a página de login
self.assertFalse(Comanda.objects.filter(name='Comanda Teste').exists())
@@ -95,7 +95,6 @@ class CreateComandaViewTest(TestCase):
def test_create_comanda_missing_data(self):
"""Testa o comportamento ao tentar criar uma comanda com dados faltando."""
# Sem 'name-comanda'
request_sem_nome = self.factory.post(
reverse('createComanda'),
{'select-mesa': self.mesa.id}

Binary file not shown.

View File

@@ -12,6 +12,16 @@ https://docs.djangoproject.com/en/5.1/ref/settings/
import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
DB_ENGINE = os.getenv('DB_ENGINE')
DB_HOST = os.getenv('DB_HOST')
DB_PORT = os.getenv('DB_PORT')
DB_NAME = os.getenv('DB_NAME')
DB_USER = os.getenv('DB_USER')
DB_PASSWORD = os.getenv('DB_PASSWORD')
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@@ -97,10 +107,22 @@ WSGI_APPLICATION = 'gestaoRaul.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'ENGINE': DB_ENGINE,
'NAME': DB_NAME,
'USER': DB_USER,
'PASSWORD': DB_PASSWORD,
'HOST': DB_HOST,
'PORT': DB_PORT,
}
}

View File

@@ -2,6 +2,45 @@
:root {
--main-gradient: linear-gradient(145deg, #1E2A3B, #2C3E50);
--pico-modal-overlay-background-color: rgba(8, 9, 10, 0.75);
--pico-font-family-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--pico-font-family-sans-serif: system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif, var(--pico-font-family-emoji);
--pico-font-family-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace, var(--pico-font-family-emoji);
--pico-font-family: var(--pico-font-family-sans-serif);
--pico-line-height: 1.5;
--pico-font-weight: 400;
--pico-font-size: 100%;
--pico-text-underline-offset: 0.1rem;
--pico-border-radius: 0.25rem;
--pico-border-width: 0.0625rem;
--pico-outline-width: 0.125rem;
--pico-transition: 0.2s ease-in-out;
--pico-spacing: 1rem;
--pico-typography-spacing-vertical: 1rem;
--pico-block-spacing-vertical: var(--pico-spacing);
--pico-block-spacing-horizontal: var(--pico-spacing);
--pico-grid-column-gap: var(--pico-spacing);
--pico-grid-row-gap: var(--pico-spacing);
--pico-form-element-spacing-vertical: 0.75rem;
--pico-form-element-spacing-horizontal: 1rem;
--pico-group-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
--pico-group-box-shadow-focus-with-button: 0 0 0 var(--pico-outline-width) var(--pico-primary-focus);
--pico-group-box-shadow-focus-with-input: 0 0 0 0.0625rem var(--pico-form-element-border-color);
--pico-modal-overlay-backdrop-filter: blur(0.375rem);
--pico-nav-element-spacing-vertical: 1rem;
--pico-nav-element-spacing-horizontal: 0.5rem;
--pico-nav-link-spacing-vertical: 0.5rem;
--pico-nav-link-spacing-horizontal: 0.5rem;
--pico-nav-breadcrumb-divider: ">";
--pico-icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-loading: url("data:image/svg+xml,%3Csvg fill='none' height='24' width='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3E%3Cstyle%3E g %7B animation: rotate 2s linear infinite; transform-origin: center center; %7D circle %7B stroke-dasharray: 75,100; stroke-dashoffset: -5; animation: dash 1.5s ease-in-out infinite; stroke-linecap: round; %7D @keyframes rotate %7B 0%25 %7B transform: rotate(0deg); %7D 100%25 %7B transform: rotate(360deg); %7D %7D @keyframes dash %7B 0%25 %7B stroke-dasharray: 1,100; stroke-dashoffset: 0; %7D 50%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -17.5; %7D 100%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -62; %7D %7D %3C/style%3E%3Cg%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='rgb(136, 145, 164)' stroke-width='4' /%3E%3C/g%3E%3C/svg%3E");
}
@keyframes jump {
@@ -107,6 +146,27 @@ input, textarea, select {
font-family: 'Inter', sans-serif;
}
.card-product {
height: 180px;
width: 200px;
padding: 10px;
align-items: center;
align-content: center;
text-align: center;
line-height: 1.5;
background: var(--main-gradient);
box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678);
border-radius: 5px;
transition: transform 0.4s, box-shadow 0.4s;
}
.card-product:hover {
transform: scale(1.05);
transition: transform 0.4s, box-shadow 0.4s;
box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815);
}
.p-header {
background-color: #24252a;
box-shadow: 0px 3px 10px #464646;
@@ -389,8 +449,6 @@ input, textarea, select {
.header-mobile {
display: none;
justify-content: space-between;
@@ -493,9 +551,6 @@ input, textarea, select {
.background .bg1 {
max-height: 21.5%;
}
/* .nav-bar {
display: none;
} */
.header-mobile {
display: flex;

View File

@@ -15,7 +15,7 @@
margin: 0 auto;
}
.card-product {
/* .card-product {
background: var(--main-gradient);
box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678);
@@ -24,7 +24,7 @@
.card-product:hover {
transform: scale(1.05);
box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815);
}
} */
table td th {
text-align: center;

View File

@@ -18,7 +18,7 @@
max-width: 800px;
}
.card-product {
/* .card-product {
height: 180px;
width: 200px;
padding: 10px;
@@ -36,7 +36,7 @@
transform: scale(1.05);
transition: transform 0.4s, box-shadow 0.4s;
box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815);
}
} */
table td th {
text-align: center;

View File

@@ -1,50 +1,5 @@
@charset "UTF-8";
/*!
* Pico CSS ✨ v2.0.6 (https://picocss.com)
* Copyright 2019-2024 - Licensed under MIT
*/
/**
* Styles
*/
:root {
--pico-font-family-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--pico-font-family-sans-serif: system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif, var(--pico-font-family-emoji);
--pico-font-family-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace, var(--pico-font-family-emoji);
--pico-font-family: var(--pico-font-family-sans-serif);
--pico-line-height: 1.5;
--pico-font-weight: 400;
--pico-font-size: 100%;
--pico-text-underline-offset: 0.1rem;
--pico-border-radius: 0.25rem;
--pico-border-width: 0.0625rem;
--pico-outline-width: 0.125rem;
--pico-transition: 0.2s ease-in-out;
--pico-spacing: 1rem;
--pico-typography-spacing-vertical: 1rem;
--pico-block-spacing-vertical: var(--pico-spacing);
--pico-block-spacing-horizontal: var(--pico-spacing);
--pico-grid-column-gap: var(--pico-spacing);
--pico-grid-row-gap: var(--pico-spacing);
--pico-form-element-spacing-vertical: 0.75rem;
--pico-form-element-spacing-horizontal: 1rem;
--pico-group-box-shadow: 0 0 0 rgba(0, 0, 0, 0);
--pico-group-box-shadow-focus-with-button: 0 0 0 var(--pico-outline-width) var(--pico-primary-focus);
--pico-group-box-shadow-focus-with-input: 0 0 0 0.0625rem var(--pico-form-element-border-color);
--pico-modal-overlay-backdrop-filter: blur(0.375rem);
--pico-nav-element-spacing-vertical: 1rem;
--pico-nav-element-spacing-horizontal: 0.5rem;
--pico-nav-link-spacing-vertical: 0.5rem;
--pico-nav-link-spacing-horizontal: 0.5rem;
--pico-nav-breadcrumb-divider: ">";
--pico-icon-checkbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-minus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(255, 255, 255)' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-date: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-time: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(136, 145, 164)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
--pico-icon-loading: url("data:image/svg+xml,%3Csvg fill='none' height='24' width='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3E%3Cstyle%3E g %7B animation: rotate 2s linear infinite; transform-origin: center center; %7D circle %7B stroke-dasharray: 75,100; stroke-dashoffset: -5; animation: dash 1.5s ease-in-out infinite; stroke-linecap: round; %7D @keyframes rotate %7B 0%25 %7B transform: rotate(0deg); %7D 100%25 %7B transform: rotate(360deg); %7D %7D @keyframes dash %7B 0%25 %7B stroke-dasharray: 1,100; stroke-dashoffset: 0; %7D 50%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -17.5; %7D 100%25 %7B stroke-dasharray: 44.5,100; stroke-dashoffset: -62; %7D %7D %3C/style%3E%3Cg%3E%3Ccircle cx='12' cy='12' r='10' fill='none' stroke='rgb(136, 145, 164)' stroke-width='4' /%3E%3C/g%3E%3C/svg%3E");
}
@media (min-width: 576px) {
:root {
--pico-font-size: 106.25%;
@@ -467,7 +422,7 @@ details summary[role=button]:not(.outline)::after {
filter: brightness(0);
}
}
[data-theme=dark] {
/* [data-theme=dark] {
--pico-background-color: #13171f;
--pico-color: #c2c7d0;
--pico-text-selection-color: rgba(1, 170, 255, 0.1875);
@@ -570,7 +525,7 @@ details summary[role=button]:not(.outline)::after {
--pico-icon-valid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(42, 123, 111)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
--pico-icon-invalid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgb(150, 74, 80)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
color-scheme: dark;
}
} */
[data-theme=dark] input:is([type=submit],
[type=button],
[type=reset],