Commit b749455b authored by Michele Del Giudice's avatar Michele Del Giudice
Browse files

Guvicorn & Tests

parent b0e07009
...@@ -13,12 +13,12 @@ RUN apt-get update && \ ...@@ -13,12 +13,12 @@ RUN apt-get update && \
COPY requirements.txt ./ COPY requirements.txt ./
RUN pip install --upgrade pip && \ RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt pip install --no-cache-dir -r requirements.txt && \
pip install gunicorn
# Copy application # Copy application
COPY . /app COPY . /app
ENV FLASK_APP=app:create_app
EXPOSE 5000 EXPOSE 5000
# Healthcheck: call the Flask /health endpoint # Healthcheck: call the Flask /health endpoint
...@@ -26,4 +26,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ ...@@ -26,4 +26,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
CMD curl -fS http://127.0.0.1:5000/health || exit 1 CMD curl -fS http://127.0.0.1:5000/health || exit 1
# Use gunicorn and call the factory to create the app # Use gunicorn and call the factory to create the app
CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:create_app()"] CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
...@@ -3,13 +3,13 @@ from datetime import datetime, timedelta ...@@ -3,13 +3,13 @@ from datetime import datetime, timedelta
import pytest import pytest
from app import create_app from app import app as flask_app
from models import db, Car from models import db, Car
@pytest.fixture @pytest.fixture
def app(): def app():
app = create_app() app = flask_app
app.config.update({ app.config.update({
'TESTING': True, 'TESTING': True,
# Use in-memory SQLite for tests # Use in-memory SQLite for tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment