config.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. """Config constants."""
  2. from pathlib import Path
  3. from types import SimpleNamespace
  4. from reflex.constants.base import Dirs, Reflex
  5. from .compiler import Ext
  6. # Alembic migrations
  7. ALEMBIC_CONFIG = "alembic.ini"
  8. class Config(SimpleNamespace):
  9. """Config constants."""
  10. # The name of the reflex config module.
  11. MODULE = "rxconfig"
  12. # The python config file.
  13. FILE = Path(f"{MODULE}{Ext.PY}")
  14. class Expiration(SimpleNamespace):
  15. """Expiration constants."""
  16. # Token expiration time in seconds
  17. TOKEN = 60 * 60
  18. # Maximum time in milliseconds that a state can be locked for exclusive access.
  19. LOCK = 1000
  20. # The PING timeout
  21. PING = 120
  22. class GitIgnore(SimpleNamespace):
  23. """Gitignore constants."""
  24. # The gitignore file.
  25. FILE = Path(".gitignore")
  26. # Files to gitignore.
  27. DEFAULTS = {Dirs.WEB, "*.db", "__pycache__/", "*.py[cod]", "assets/external/"}
  28. class RequirementsTxt(SimpleNamespace):
  29. """Requirements.txt constants."""
  30. # The requirements.txt file.
  31. FILE = "requirements.txt"
  32. # The partial text used to form requirement that pins a reflex version
  33. DEFAULTS_STUB = f"{Reflex.MODULE_NAME}=="
  34. class DefaultPorts(SimpleNamespace):
  35. """Default port constants."""
  36. FRONTEND_PORT = 3000
  37. BACKEND_PORT = 8000
  38. # The deployment URL.
  39. PRODUCTION_BACKEND_URL = "https://{username}-{app_name}.api.pynecone.app"