config.py 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import os
  2. import platform
  3. # Check if running under pytest
  4. TESTING = "PYTEST_CURRENT_TEST" in os.environ
  5. # Base Directory
  6. BASE_DIR = os.path.dirname(os.path.abspath(__file__))
  7. # Debugging
  8. DEBUG = os.getenv("RADIONICA_DEBUG", "True").lower() == "true"
  9. # Slicer Settings
  10. # If True, triggers synchronous slicing upon file upload (slower upload, exact metrics on UI)
  11. SYNC_SLICING_ON_UPLOAD = os.getenv("SYNC_SLICING", "True").lower() == "true"
  12. IS_WINDOWS = platform.system() == "Windows"
  13. if IS_WINDOWS:
  14. # Default Windows path
  15. SLICER_PATH = os.getenv("SLICER_PATH", r"C:\Program Files\Prusa3D\PrusaSlicer\prusa-slicer-console.exe")
  16. else:
  17. # Default Linux path (binary name if in PATH, or absolute path)
  18. SLICER_PATH = os.getenv("SLICER_PATH", "prusa-slicer")
  19. # Profile configuration (can be changed per machine)
  20. SLICER_CONFIG = os.getenv("SLICER_CONFIG", os.path.join(BASE_DIR, "printer_profile.ini"))
  21. # Order settings
  22. UPLOAD_DIR = os.getenv("UPLOAD_DIR", os.path.join(BASE_DIR, "uploads"))
  23. PREVIEW_DIR = os.path.join(UPLOAD_DIR, "previews")
  24. for d in [UPLOAD_DIR, PREVIEW_DIR]:
  25. if not os.path.exists(d):
  26. os.makedirs(d)
  27. # Payment Config
  28. ZIRO_RACUN = os.getenv("ZIRO_RACUN", "510-1234567890123-45")
  29. COMPANY_NAME = "RADIONICA 3D"
  30. COMPANY_PIB = os.getenv("COMPANY_PIB", "01234567")
  31. COMPANY_CITY = "Podgorica"
  32. COMPANY_ADDRESS = "Cetinjski Put, Podgorica, Montenegro"
  33. PDV_RATE = 21 # In percent
  34. # EFI Fiskalizacija
  35. EFI_ENABLED = os.getenv("EFI_ENABLED", "False").lower() == "true"
  36. EFI_CERT_PATH = os.getenv("EFI_CERT_PATH", os.path.join(BASE_DIR, "cert.p12"))
  37. EFI_CERT_PASS = os.getenv("EFI_CERT_PASS", "changeit")
  38. EFI_ENU_CODE = os.getenv("EFI_ENU_CODE", "xx123yy456")
  39. EFI_BUS_UNIT = os.getenv("EFI_BUS_UNIT", "br123")
  40. EFI_OPERATOR = os.getenv("EFI_OPERATOR", "op123")
  41. EFI_STAGING = os.getenv("EFI_STAGING", "True").lower() == "true"
  42. GOOGLE_CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID", "254513580225-j893ad8nd2f2celd2thn1l42miqm9e7s.apps.googleusercontent.com")
  43. # SMTP Configuration (Local MTA)
  44. SMTP_HOST = os.getenv("SMTP_HOST", "localhost")
  45. SMTP_PORT = int(os.getenv("SMTP_PORT", "25"))
  46. SMTP_USER = os.getenv("SMTP_USER", "")
  47. SMTP_PASS = os.getenv("SMTP_PASS", "")
  48. SMTP_FROM = os.getenv("SMTP_FROM", "hello@radionica3d.me")
  49. # Frontend URL for links in emails
  50. FRONTEND_URL = os.getenv("FRONTEND_URL", "https://radionica3d.me")
  51. # Telegram Notifications
  52. TELEGRAM_CHAT_ID = os.getenv("CHAT_ID")