Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@ RUN pip install --no-cache-dir -r requirements.txt

COPY . .

ENV PORT=5000
ENV GUNICORN_WORKERS=4
ENV GUNICORN_CMD_ARGS="--bind 0.0.0.0:${PORT} --workers ${GUNICORN_WORKERS}"


EXPOSE 5000
CMD ["python", "app.py"]
CMD ["gunicorn", "run:app"]
7 changes: 1 addition & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ def create_app():
load_dotenv()

app = Flask(__name__)
app.config["MONGO_URI"] = os.getenv("MONGO_URI")
app.config["MONGO_DB"] = os.getenv("MONGO_DB")
app.config.from_pyfile(filename='.env', silent=True)

api.init_app(app)

app.register_error_handler(Exception, lambda error: ErrorHandler(error)())

return app

if __name__ == '__main__':
app = create_app()
app.run(debug=True)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ tzdata==2025.1
factory_boy==3.3.3
pytest==8.3.4
python-dotenv==1.0.1
pytest-cov==7.0.0
pytest-cov==7.0.0
gunicorn==25.1.0
11 changes: 11 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from app import create_app


app = create_app()

if __name__ == "__main__":
app.run(
debug=app.config["FLASK_DEBUG"],
host=app.config["SERVER"],
port=app.config["PORT"]
)
7 changes: 2 additions & 5 deletions test/fixtures/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ def client(collection):
from app import create_app
app = create_app()

app.config.update({
"MONGO_CONNECTION": TEST_MONGO_URI,
"MONGO_DB": TEST_DB_NAME,
"TESTING": True,
})
app.config["MONGO_URI"] = TEST_MONGO_URI
app.config["MONGO_DB"] = TEST_DB_NAME

test_client = Client(app)

Expand Down