So I'm been trying to dockerized my Django app with apache on a container and I keep getting this error
Invalid command 'WSGIProcessGroup', perhaps misspelled or defined by a module not included in the server configuration
I tried to install mod_wsgi with apt and pip but the result was still the same
Here is my Dockerfile
FROM httpd:2.4
ADD ./requirements.txt ./
RUN apt-get update \
&& apt-get install -y \
python3-pip python3-venv \
libapr1 libapr1-dev \
libaprutil1-dev \
libapache2-mod-wsgi \
&& python3 -m venv /.cp \
&& /.cp/bin/pip install --no-cache-dir -r requirements.txt \
&& rm -rf /var/lib/apt/lists/*
The requirements.txt
django
mod-wsgi
psycopg2-binary
djangorestframework
markdown
django-filter
my custom vhost file
<VirtualHost *:80>
serverAdmin svenikia@taskmaster.com
DocumentRoot "/usr/local/apache2/htdocs/webapp"
Servername www.webapp.io
ServerAlias webapp.io
ErrorLog "/var/log/apache2/error.log"
CustomLog "/var/log/apache2/access.log" combined
Alias /static /capstone/static
<Directory "/usr/local/apache2/htdocs/webapp/static">
Require all granted
AllowOverride None
</Directory>
<Directory "/usr/local/apache2/htdocs/webapp/webapp">
<Files wsgi.py>
AllowOverride None
Require all granted
</Files>
</Directory>
WSGIProcessGroup webapp_project
WSGIDaemonProcess webapp_project python-path=/webapp python-home=/.env
WSGIScriptAlias / /usr/local/apache2/htdocs/webapp/webapp/wsgi.py
</VirtualHost>
And this is my docker compose file
version: '2'
services:
postgres:
image: postgres:13.1-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: parking
restart: always
container_name: db
apache:
build : ./Django
image: web:1.0
container_name: web
ports:
- "8080:80"
volumes:
- ./my-httpd.conf:/usr/local/apache2/conf/httpd.conf
- ./Django/web.conf:/usr/local/apache2/conf/extra/httpd-vhosts.conf
- ./Django/web:/usr/local/apache2/htdocs/my-web
networks:
default:
external:
name: network
At first my initial idea was to have 3 containers, one for postgres, the second for django and the third for apache. But after many fail attemps, I just go with 2 containers one for postgres and the other for generating virtualenv, django app and apache. Any help would be great, thank you