3v324v23 commited on
Commit
d354041
·
1 Parent(s): e91bb72

fix: add main() function and __main__ guard to server/app.py

Browse files
Files changed (1) hide show
  1. server/app.py +19 -3
server/app.py CHANGED
@@ -1,5 +1,21 @@
1
  """
2
- server/app.py — Required by OpenEnv multi-mode deployment standard.
3
- Re-exports the FastAPI app and main entry point from the root api module.
4
  """
5
- from api import app, main # noqa: F401
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  """
2
+ server/app.py — OpenEnv multi-mode deployment entry point.
3
+ Required by the OpenEnv standard for server-mode deployment.
4
  """
5
+ import sys
6
+ import os
7
+
8
+ # Ensure root directory is importable
9
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
10
+
11
+ from api import app # noqa: F401
12
+
13
+
14
+ def main():
15
+ """Server entry point called by 'server' script in pyproject.toml."""
16
+ import uvicorn
17
+ uvicorn.run("server.app:app", host="0.0.0.0", port=7860)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ main()