""" Django settings for gestaoRaul project. Generated by 'django-admin startproject' using Django 5.1.4. For more information on this file, see https://docs.djangoproject.com/en/5.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.1/ref/settings/ """ import os from pathlib import Path from datetime import timedelta 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 # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-mqcnrs5!hc6bj$�@@9d8^2@x#w&$qhk3vlr5_)3znd9h6&d8') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.getenv('DEBUG', 'True') == 'True' ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'products', 'mesas', 'typePay', 'clients', 'comandas', 'categories', 'home', 'payments', 'balcao', 'orders', 'login', 'sync', 'django_extensions', 'pwa', 'rest_framework', 'corsheaders', ] MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'gestaoRaul.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates'),], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] 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': DB_ENGINE, # 'NAME': DB_NAME, # 'USER': DB_USER, # 'PASSWORD': DB_PASSWORD, # 'HOST': DB_HOST, # 'PORT': DB_PORT, # } # } # Password validation # https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/5.1/topics/i18n/ LANGUAGE_CODE = 'pt-BR' TIME_ZONE = 'America/Sao_Paulo' USE_I18N = True USE_TZ = True DATE_FORMAT = 'd/m/Y - H:M' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/5.1/howto/static-files/ STATIC_URL = 'static/' STATICFILES_DIRS = (os.path.join(BASE_DIR, 'templates/static'),) STATIC_ROOT = os.path.join(BASE_DIR, 'static') # WhiteNoise storage to compress and cache static files STORAGES = { "default": { "BACKEND": "django.core.files.storage.FileSystemStorage", }, "staticfiles": { "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", }, } MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' # Default primary key field type # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # pwa.py # from django.conf import settings PWA_APP_NAME = "Gestão Raul" PWA_APP_SHORT_NAME = "PWA" PWA_APP_DESCRIPTION = "Descrição do Gestão Raul" PWA_APP_THEME_COLOR = "#000000" PWA_APP_BACKGROUND_COLOR = "#ffffff" PWA_APP_DISPLAY = "standalone" PWA_APP_ORIENTATION = "any" PWA_APP_START_URL = "/" PWA_APP_ICONS = [ { "src": "/static/midia/logo.png", "sizes": "160x160", "type": "image/png" }, # ... adicione outros tamanhos de ícones ] PWA_APP_SPLASH_SCREEN = { "src": "/static/midia/logo.png", "media": "(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)" } PWA_APP_DIR = "ltr" PWA_APP_LANG = "pt-BR" # --- REST FRAMEWORK & CORS --- CORS_ALLOW_ALL_ORIGINS = True # Para desenvolvimento CORS_ALLOW_CREDENTIALS = True # Permite envio de cookies para SessionAuth REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.SessionAuthentication', # Prioridade para teste no navegador 'rest_framework_simplejwt.authentication.JWTAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.IsAuthenticated', ), } SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60), 'REFRESH_TOKEN_LIFETIME': timedelta(days=1), }