config.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 = 10000
  20. # The PING timeout
  21. PING = 120
  22. # The maximum time in milliseconds to hold a lock before throwing a warning.
  23. LOCK_WARNING_THRESHOLD = 1000
  24. class GitIgnore(SimpleNamespace):
  25. """Gitignore constants."""
  26. # The gitignore file.
  27. FILE = Path(".gitignore")
  28. # Files to gitignore.
  29. DEFAULTS = {
  30. Dirs.WEB,
  31. Dirs.STATES,
  32. "*.db",
  33. "__pycache__/",
  34. "*.py[cod]",
  35. "assets/external/",
  36. }
  37. class PyprojectToml(SimpleNamespace):
  38. """Pyproject.toml constants."""
  39. # The pyproject.toml file.
  40. FILE = "pyproject.toml"
  41. class RequirementsTxt(SimpleNamespace):
  42. """Requirements.txt constants."""
  43. # The requirements.txt file.
  44. FILE = "requirements.txt"
  45. # The partial text used to form requirement that pins a reflex version
  46. DEFAULTS_STUB = f"{Reflex.MODULE_NAME}=="
  47. class DefaultPorts(SimpleNamespace):
  48. """Default port constants."""
  49. FRONTEND_PORT = 3000
  50. BACKEND_PORT = 8000
  51. # The deployment URL.
  52. PRODUCTION_BACKEND_URL = "https://{username}-{app_name}.api.pynecone.app"