config.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. CHAT_UPLOADS_DIR = os.path.join(UPLOAD_DIR, "chats")
  25. for d in [UPLOAD_DIR, PREVIEW_DIR, CHAT_UPLOADS_DIR]:
  26. if not os.path.exists(d):
  27. os.makedirs(d)
  28. # Payment Config
  29. ZIRO_RACUN = os.getenv("ZIRO_RACUN", "510-1234567890123-45")
  30. COMPANY_NAME = "RADIONICA 3D"
  31. COMPANY_PIB = os.getenv("COMPANY_PIB", "01234567")
  32. COMPANY_CITY = "Podgorica"
  33. COMPANY_ADDRESS = "Cetinjski Put, Podgorica, Montenegro"
  34. PDV_RATE = 21 # In percent
  35. DEFAULT_PRINTER_HOUR_PRICE = 2.0 # Default price per hour of printing
  36. # EFI Fiskalizacija
  37. EFI_ENABLED = os.getenv("EFI_ENABLED", "False").lower() == "true"
  38. EFI_CERT_PATH = os.getenv("EFI_CERT_PATH", os.path.join(BASE_DIR, "cert.p12"))
  39. EFI_CERT_PASS = os.getenv("EFI_CERT_PASS", "changeit")
  40. EFI_ENU_CODE = os.getenv("EFI_ENU_CODE", "xx123yy456")
  41. EFI_BUS_UNIT = os.getenv("EFI_BUS_UNIT", "br123")
  42. EFI_OPERATOR = os.getenv("EFI_OPERATOR", "op123")
  43. EFI_STAGING = os.getenv("EFI_STAGING", "True").lower() == "true"
  44. GOOGLE_CLIENT_ID = os.getenv("GOOGLE_CLIENT_ID", "254513580225-j893ad8nd2f2celd2thn1l42miqm9e7s.apps.googleusercontent.com")
  45. # SMTP Configuration (Local MTA)
  46. SMTP_HOST = os.getenv("SMTP_HOST", "localhost")
  47. SMTP_PORT = int(os.getenv("SMTP_PORT", "25"))
  48. SMTP_USER = os.getenv("SMTP_USER", "")
  49. SMTP_PASS = os.getenv("SMTP_PASS", "")
  50. SMTP_FROM = os.getenv("SMTP_FROM", "hello@radionica3d.me")
  51. # Frontend URL for links in emails
  52. FRONTEND_URL = os.getenv("FRONTEND_URL", "https://radionica3d.me")
  53. # Telegram Notifications
  54. TELEGRAM_CHAT_ID = os.getenv("CHAT_ID")
  55. # Redis Configuration
  56. REDIS_HOST = os.getenv("REDIS_HOST", "localhost")
  57. REDIS_PORT = int(os.getenv("REDIS_PORT", "6379"))