Spaces:
Sleeping
Sleeping
Update server/app.py
Browse files- server/app.py +5 -19
server/app.py
CHANGED
|
@@ -1,33 +1,19 @@
|
|
| 1 |
"""
|
| 2 |
-
server/app.py
|
| 3 |
-
=============================================
|
| 4 |
-
|
| 5 |
-
The OpenEnv validator requires:
|
| 6 |
-
1. A `app` object at server.app:app (FastAPI instance)
|
| 7 |
-
2. A callable `main()` function (referenced by pyproject.toml scripts)
|
| 8 |
-
3. An `if __name__ == '__main__':` block
|
| 9 |
-
|
| 10 |
-
This file re-exports `app` from env.py and adds the required main()
|
| 11 |
-
so the validator's multi-mode deployment check passes.
|
| 12 |
"""
|
| 13 |
|
| 14 |
import sys
|
| 15 |
import os
|
| 16 |
|
| 17 |
-
# Allow `import env` to resolve from the project root when this module
|
| 18 |
-
# is loaded as `server.app` (working directory is /app).
|
| 19 |
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 20 |
|
| 21 |
-
from env import app
|
| 22 |
|
| 23 |
-
__all__ = ["app"
|
| 24 |
|
| 25 |
|
| 26 |
-
def main()
|
| 27 |
-
"""
|
| 28 |
-
Entry point declared in pyproject.toml [project.scripts].
|
| 29 |
-
Starts the uvicorn server on 0.0.0.0:7860.
|
| 30 |
-
"""
|
| 31 |
import uvicorn
|
| 32 |
uvicorn.run(
|
| 33 |
"server.app:app",
|
|
|
|
| 1 |
"""
|
| 2 |
+
server/app.py - OpenEnv Validator Entry Point
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"""
|
| 4 |
|
| 5 |
import sys
|
| 6 |
import os
|
| 7 |
|
|
|
|
|
|
|
| 8 |
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 9 |
|
| 10 |
+
from env import app
|
| 11 |
|
| 12 |
+
__all__ = ["app"]
|
| 13 |
|
| 14 |
|
| 15 |
+
def main():
|
| 16 |
+
"""Entry point for [project.scripts] and direct execution."""
|
|
|
|
|
|
|
|
|
|
| 17 |
import uvicorn
|
| 18 |
uvicorn.run(
|
| 19 |
"server.app:app",
|