Skip to content

Commit d875f25

Browse files
committed
feat: expose port 8080 in Dockerfile and update application entry point
1 parent f124c6e commit d875f25

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ENTRYPOINT []
3232

3333
RUN python setup.py
3434

35+
EXPOSE 8080
3536
# Run the FastAPI application by default
3637
# Uses `fastapi dev` to enable hot-reloading when the `watch` sync occurs
3738
# Uses `--host 0.0.0.0` to allow access from outside the container

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
---
2+
title: Python Project Template
3+
emoji: 🟧
4+
colorFrom: yellow
5+
colorTo: purple
6+
sdk: docker
7+
tags:
8+
- Python
9+
fullwidth: true
10+
license: mit
11+
app_port: 8080
12+
---
13+
114
# Python Project Template
215

316
A modern Python project template with best practices for development, testing, and deployment.

src/modules/api/app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
from .routes import v1_router
77

8+
89
def create_app() -> FastAPI:
910
"""Create and configure the FastAPI application."""
10-
app = FastAPI(
11-
12-
)
11+
app = FastAPI()
1312

1413
# Add CORS middleware
1514
app.add_middleware(
@@ -35,5 +34,6 @@ async def shutdown_event():
3534

3635
return app
3736

37+
3838
# Create default app instance
39-
app = create_app()
39+
app = create_app()

src/modules/api/index.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import uvicorn
1+
import uvicorn
22
from .app import app as api_app
3+
import logging
4+
35

46
def main():
57
"""Main application entry point."""
@@ -8,10 +10,12 @@ def main():
810
uvicorn.run(
911
api_app,
1012
host="0.0.0.0",
11-
port=8800,
13+
port=8080,
1214
reload=False,
1315
)
1416
except Exception as e:
15-
print(f"Application failed to start: {e}", exc_info=True)
17+
logging.error(f"Application failed to start: {e}", exc_info=True)
1618
raise
17-
main()
19+
20+
21+
main()

0 commit comments

Comments
 (0)