fix wsgi.py;
added entrypoint.sh as django entrypoint; install and use gunicorn as prod server;
This commit is contained in:
parent
065922b279
commit
560c688817
@ -1,15 +1,12 @@
|
||||
FROM python:3.8-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN apt-get update; \
|
||||
apt-get install -y build-essential gcc; \
|
||||
python -m venv /opt/venv; \
|
||||
python -m pip install --upgrade pip;
|
||||
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
RUN mkdir /code
|
||||
python -m pip install --upgrade pip; \
|
||||
mkdir /code;
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
@ -19,3 +16,6 @@ COPY requirements.txt /code/
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY . /code/
|
||||
|
||||
RUN chmod 777 scripts/entrypoint.sh
|
||||
ENTRYPOINT ["scripts/entrypoint.sh"]
|
||||
|
||||
@ -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()
|
||||
|
||||
10
backend/scripts/entrypoint.sh
Normal file
10
backend/scripts/entrypoint.sh
Normal 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
|
||||
@ -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')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user