fix wsgi.py;

added entrypoint.sh as django entrypoint;
install and use gunicorn as prod server;
This commit is contained in:
Marco Zeisler 2021-05-04 19:37:38 +02:00
parent 065922b279
commit 560c688817
4 changed files with 28 additions and 17 deletions

View File

@ -1,21 +1,21 @@
FROM python:3.8-slim
FROM python:3.8-slim
ENV PYTHONUNBUFFERED 1
ENV PATH="/opt/venv/bin:$PATH"
ENV PYTHONUNBUFFERED 1
RUN apt-get update; \
apt-get install -y build-essential gcc; \
python -m venv /opt/venv; \
python -m pip install --upgrade pip; \
mkdir /code;
RUN apt-get update; \
apt-get install -y build-essential gcc; \
python -m venv /opt/venv; \
python -m pip install --upgrade pip;
WORKDIR /code
ENV PATH="/opt/venv/bin:$PATH"
COPY setup.py /code/
COPY requirements.txt /code/
RUN mkdir /code
RUN pip install -r requirements.txt
WORKDIR /code
COPY . /code/
COPY setup.py /code/
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
RUN chmod 777 scripts/entrypoint.sh
ENTRYPOINT ["scripts/entrypoint.sh"]

View File

@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ app_be }}.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app_be.settings")
application = get_wsgi_application()

View File

@ -0,0 +1,10 @@
#!/bin/bash
# executes the manage.py commands to setup and starts the server
echo "setup"
python manage.py makemigrations
python manage.py makemigrations app_be
python manage.py migrate
echo "run server"
gunicorn app_be.wsgi:application -b 0.0.0.0 -p 8000

View File

@ -21,7 +21,8 @@ setup(name='waecm-2021-group-04',
'python-dotenv==0.17.1',
'feedsearch==1.0.12',
'Pillow==8.2.0',
'python-dateutil==2.8.1'
'python-dateutil==2.8.1',
'gunicorn==20.1.0'
],
license='BSD License', # example license
description='DESCRIPTION')