config.py 1.4 KB

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