Spaces:
Sleeping
Sleeping
| # test_startup.py | |
| print("--- Starting Application Object Test ---") | |
| # 1. Import the necessary components | |
| import os | |
| import sys | |
| # Add the application root to the path so imports work | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| # 2. Try to import the application file and object | |
| try: | |
| # Assuming your main file is 'app.py' and the object is 'app' | |
| from app import app | |
| print("SUCCESS: FastAPI object ('app') imported successfully.") | |
| # You could add a small model call here if you want to test further | |
| # e.g., print(app.dependency_on_model.status) | |
| except Exception as e: | |
| print(f"FAILURE: An error occurred during application import.") | |
| print(f"Error details: {e}") | |
| sys.exit(1) | |
| print("--- Startup Test Finished Successfully ---") | |
| sys.exit(0) |