""" Django settings für einfaches Docker Setup """ from pathlib import Path import os from dotenv import load_dotenv # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Lade .env Datei load_dotenv(BASE_DIR / '.env') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-qddfdhpsm$=%o8p74xo8q9wbsa5^818(dzl4f&yrdcyn=050dt') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.getenv('DEBUG', 'True').lower() == 'true' ALLOWED_HOSTS = ['localhost', '127.0.0.1', '0.0.0.0', '*'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', 'shop.apps.ShopConfig', 'products.apps.ProductsConfig', 'paypal_integration', 'paypal.standard.ipn', 'payments', 'rest_framework', 'rest_framework.authtoken', 'django_filters', 'corsheaders', 'products', 'shop', 'recommendations', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', '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 = 'webshop.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR / 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.template.context_processors.static', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'webshop.wsgi.application' # Database - SQLite für einfaches Setup DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation 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 LANGUAGE_CODE = 'de' LANGUAGES = [ ('de', 'Deutsch'), ('en', 'English'), ] TIME_ZONE = 'Europe/Berlin' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = [ BASE_DIR / 'static', ] # Media files (Uploads) MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # Stellen Sie sicher, dass der media-Ordner existiert if not os.path.exists(MEDIA_ROOT): os.makedirs(MEDIA_ROOT) # Default primary key field type DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # Stripe Einstellungen STRIPE_PUBLISHABLE_KEY = os.getenv('STRIPE_PUBLISHABLE_KEY', '') STRIPE_SECRET_KEY = os.getenv('STRIPE_SECRET_KEY', '') STRIPE_WEBHOOK_SECRET = os.getenv('STRIPE_WEBHOOK_SECRET', '') # E-Mail-Einstellungen (temporär Console-Backend) EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' DEFAULT_FROM_EMAIL = 'Fursuit Shop ' # Admin-E-Mail-Empfänger ADMINS = [ ('Shop Admin', 'admin@fursuitshop.com'), ] # Lagerbestand-Einstellungen LOW_STOCK_THRESHOLD = 5 # Authentication Settings LOGIN_URL = 'login' LOGIN_REDIRECT_URL = 'products:product_list' LOGOUT_REDIRECT_URL = 'shop:home' SITE_URL = os.getenv('SITE_URL', 'http://127.0.0.1:8000') # PayPal Einstellungen PAYPAL_TEST = True PAYPAL_RECEIVER_EMAIL = 'sb-43wjt28371773@business.example.com' PAYPAL_CURRENCY_CODE = 'EUR' # REST Framework REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.SessionAuthentication', ], 'DEFAULT_PERMISSION_CLASSES': [ 'rest_framework.permissions.IsAuthenticatedOrReadOnly', ], 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 20, 'DEFAULT_FILTER_BACKENDS': [ 'django_filters.rest_framework.DjangoFilterBackend', 'rest_framework.filters.SearchFilter', 'rest_framework.filters.OrderingFilter', ], } # CORS Settings CORS_ALLOWED_ORIGINS = [ "http://localhost:3000", "http://127.0.0.1:3000", "http://localhost:8000", "http://127.0.0.1:8000", ] CORS_ALLOW_CREDENTIALS = True # Site ID SITE_ID = 1