Cleanup requirements files

And add requirements file for production
This commit is contained in:
Roland Geider
2020-09-12 21:35:02 +02:00
parent 522cf1dbce
commit 96b1f50274
11 changed files with 38 additions and 22 deletions

View File

@@ -27,7 +27,7 @@ env:
# Install the application
install:
# Install requirements
- pip install -r requirements_devel.txt
- pip install -r requirements_dev.txt
- python setup.py develop
- cd wger
- if [[ "$DB" = "postgresql" ]]; then pip install psycopg2; fi

View File

@@ -4,7 +4,7 @@ include AUTHORS.txt
include AGPL.txt
include CC-BY-SA.txt
include requirements.txt
include requirements_devel.txt
include requirements_dev.txt
# Application folder as well as extras
recursive-include extras *.*

View File

@@ -26,7 +26,7 @@ Install Requirements
~~~~~~~~~~~~~~~~~~~~
::
$ pip install -r requirements_devel.txt
$ pip install -r requirements_dev.txt
$ npm install -g yarn sass
$ python setup.py develop

View File

@@ -31,7 +31,7 @@ RUN apt-get update \
# Set up the application
COPY requirements* ./
RUN pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_devel.txt
RUN pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_dev.txt
########

View File

@@ -43,7 +43,7 @@ RUN apt-get update \
# Set up the application
COPY . .
RUN pip3 install wheel \
&& pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_devel.txt
&& pip3 wheel --no-cache-dir --wheel-dir /usr/src/app/wheels -r requirements_dev.txt
########

View File

@@ -25,7 +25,7 @@ RUN apt-get update \
# Build the necessary python wheels
COPY requirements* ./
RUN pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_devel.txt
RUN pip3 wheel --no-cache-dir --wheel-dir /wheels -r requirements_prod.txt
@@ -47,14 +47,13 @@ COPY ${DOCKER_DIR}/settings.py /tmp/
COPY ${DOCKER_DIR}/entrypoint.sh /home/wger/entrypoint.sh
RUN chmod +x /home/wger/entrypoint.sh
RUN pip3 install --no-cache /wheels/* \
&& pip3 install psycopg2-binary \
&& pip3 install django-redis \
&& python3 setup.py develop
RUN chown -R wger:wger .
USER wger
RUN mkdir ~/media \
&& mkdir ~/static \
&& mkdir ~/db/
CMD ["/home/wger/entrypoint.sh"]

View File

@@ -25,5 +25,12 @@ then
chmod -R g+w ~wger/media
fi
# Run the development server
python3 manage.py runserver 0.0.0.0:8000
# Run the server
if [ -z "$WGER_USE_GUNICORN" ]
then
python3 manage.py runserver 0.0.0.0:8000
else
gunicorn wger.wsgi:application --reload --bind 0.0.0.0:8000
fi

View File

@@ -6,8 +6,8 @@ from wger.settings_global import *
# Use 'DEBUG = True' to get more details for server errors
DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = True
DEBUG = os.environ.get("DJANGO_DEBUG", True)
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
ADMINS = (
('Your name', 'your_email@example.com'),
@@ -51,9 +51,11 @@ SITE_URL = 'http://localhost:8000'
# Path to uploaded files
# Absolute filesystem path to the directory that will hold user-uploaded files.
MEDIA_ROOT = '/home/wger/media'
MEDIA_ROOT = os.environ.get("DJANGO_MEDIA_ROOT", '/home/wger/media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.environ.get("DJANGO_STATIC_ROOT", '/home/wger/static')
# Allow all hosts to access the application. Change if used in production.
ALLOWED_HOSTS = '*'

View File

@@ -1,10 +1,7 @@
#
# Requirements for wger for production
# Common requirements for wger
#
# Building/installing
wheel
# Application
bleach~=3.1
django-bootstrap-breadcrumbs~=0.9
@@ -30,9 +27,6 @@ sphinx
# AWS
#boto3
# Production
#psycopg2
#python-memcached
# REST API
django-cors-headers>=3.0

View File

@@ -1,10 +1,13 @@
#
# Requirements for wger during development
# Requirements for wger during development only
#
# Production packages
# Regular packages
-r requirements.txt
# Building/installing
wheel
# Development packages
coverage
django-debug-toolbar

11
requirements_prod.txt Normal file
View File

@@ -0,0 +1,11 @@
#
# Requirements for wger for production
#
# Regular packages
-r requirements.txt
gunicorn~=20.0
psycopg2-binary
django-redis