Skip to content

Commit 8882301

Browse files
committed
Simplify deployment: remove startup script, use direct gunicorn command
1 parent a17abb4 commit 8882301

4 files changed

Lines changed: 9 additions & 25 deletions

File tree

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ resource appService 'Microsoft.Web/sites@2024-04-01' = {
6262
httpsOnly: true
6363
siteConfig: {
6464
linuxFxVersion: 'PYTHON|3.12'
65-
appCommandLine: 'bash startup.sh'
65+
appCommandLine: 'python -m gunicorn --bind=0.0.0.0:8000 --workers=2 --timeout=600 main:app'
6666
appSettings: [
6767
{
6868
name: 'SECRET_KEY'

main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99

1010
# Import after path setup to avoid linting issues
1111
from src.app import create_app # noqa: E402
12+
from src.models import db # noqa: E402
1213

1314
app = create_app()
1415

16+
# Initialize database tables
17+
with app.app_context():
18+
db.create_all()
19+
1520
if __name__ == '__main__':
1621
app.run(debug=False, host='0.0.0.0', port=8000)

src/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ def create_app():
1818
# Get the absolute path to the project root
1919
current_dir = os.path.dirname(os.path.abspath(__file__))
2020
project_root = os.path.dirname(current_dir)
21-
21+
2222
# Set paths relative to the project structure
2323
static_folder = os.path.join(project_root, 'static')
2424
template_folder = os.path.join(current_dir, 'templates')
25-
25+
2626
app = Flask(
2727
__name__,
2828
static_folder=static_folder,
2929
template_folder=template_folder
3030
)
31-
31+
3232
# Configuration
3333
app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY', 'dev-secret-key')
3434
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(

startup.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)