From 909537ea3d77d2d18f81a8c0d7192835f96f300d Mon Sep 17 00:00:00 2001
From: Arun J <cb.en.u4cce19010@cb.students.amrita.edu>
Date: Mon, 28 Dec 2020 17:09:55 +0530
Subject: [PATCH] Switch to gunicorn

---
 Procfile         | 1 +
 README.md        | 2 +-
 requirements.txt | 2 +-
 run_prod.py      | 4 ----
 4 files changed, 3 insertions(+), 6 deletions(-)
 create mode 100644 Procfile
 delete mode 100644 run_prod.py

diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..68773f6
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: gunicorn bam:app --log-file -
diff --git a/README.md b/README.md
index 4df3dff..508586e 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ python create_db.py
 python run.py
 
 # Or alternatively, run the production server
-sudo python run_prod.py
+sudo gunicorn -w 4 -b "0.0.0.0:80" bam:app
 ```
 
 Tested on Manjaro Linux / Python 3.8.6
diff --git a/requirements.txt b/requirements.txt
index dfabc77..be6d1a7 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,6 +10,7 @@ Flask-Bcrypt==0.7.1
 Flask-Login==0.5.0
 Flask-SQLAlchemy==2.4.4
 Flask-WTF==0.14.3
+gunicorn==20.0.4
 idna==2.10
 itsdangerous==1.1.0
 Jinja2==2.11.2
@@ -26,6 +27,5 @@ toml==0.10.2
 tornado==6.1
 typed-ast==1.4.1
 typing-extensions==3.7.4.3
-waitress==1.4.4
 Werkzeug==1.0.1
 WTForms==2.3.3
diff --git a/run_prod.py b/run_prod.py
deleted file mode 100644
index 3732b4d..0000000
--- a/run_prod.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from bam import app
-from waitress import serve
-
-serve(app, host="0.0.0.0", port=80)
-- 
GitLab