Skip to content

Commit b9f121f

Browse files
committed
Fix imports and add Gunicorn with explicit startup command
1 parent 713798a commit b9f121f

4 files changed

Lines changed: 7 additions & 14 deletions

File tree

infra/main.bicep

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,8 @@ resource appService 'Microsoft.Web/sites@2024-04-01' = {
6262
httpsOnly: true
6363
siteConfig: {
6464
linuxFxVersion: 'PYTHON|3.12'
65+
appCommandLine: 'gunicorn --bind=0.0.0.0 --timeout 600 --access-logfile \'-\' --error-logfile \'-\' main:app'
6566
appSettings: [
66-
{
67-
name: 'WEBSITES_PORT'
68-
value: '8000'
69-
}
7067
{
7168
name: 'SECRET_KEY'
7269
value: secretKey

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ Flask==3.0.0
22
Flask-CORS==4.0.0
33
Flask-SQLAlchemy==3.1.1
44
SQLAlchemy==2.0.23
5+
gunicorn==21.2.0
56
python-dotenv==1.0.0
67
requests==2.31.0

src/app.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
from flask import Flask, render_template, request, jsonify
66
from flask_cors import CORS
77

8-
try:
9-
from models import db
10-
from todo_service import TodoService
11-
except ImportError:
12-
from src.models import db
13-
from src.todo_service import TodoService
8+
# Import from src package explicitly
9+
from src.models import db
10+
from src.todo_service import TodoService
1411

1512

1613
def create_app():

src/todo_service.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
from typing import List, Optional, Dict, Any
55
from sqlalchemy.exc import SQLAlchemyError
66

7-
try:
8-
from models import Todo, db
9-
except ImportError:
10-
from src.models import Todo, db
7+
# Import from src package explicitly
8+
from src.models import Todo, db
119

1210

1311
class TodoService:

0 commit comments

Comments
 (0)