-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fastapi.py
More file actions
51 lines (39 loc) · 1.17 KB
/
Copy pathtest_fastapi.py
File metadata and controls
51 lines (39 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
"""
Simple test to verify FastAPI installation and basic functionality.
"""
import sys
import asyncio
from fastapi import FastAPI
import uvicorn
# Create a simple app for testing
app = FastAPI()
@app.get("/")
async def root():
return {"message": "FastAPI is working!"}
@app.get("/test")
async def test():
return {"status": "ok", "test": "successful"}
if __name__ == "__main__":
print("Testing FastAPI installation...")
# Test imports
try:
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
print("✓ All imports successful")
except ImportError as e:
print(f"✗ Import error: {e}")
sys.exit(1)
# Test creating app
try:
test_app = FastAPI()
print("✓ FastAPI app creation successful")
except Exception as e:
print(f"✗ App creation error: {e}")
sys.exit(1)
print("\nFastAPI installation test passed!")
print("You can now run the main application with:")
print(" cd /home/tonyhe/TonyHe-Gitlab/datalab")
print(" source venv/bin/activate")
print(" python -m src.backend.main")