Python image based on debian:wheezy and with usefull scripts.
500K+
Contains:
Image works with this tree stucture in /srv directory. There should be all of your data.
After start the container, start script call:
pip install -r /srv/app/requirements.txt
It installs requirements of your app. After this step, script will call /src/app/init.sh. There should be everything what you want to do after container starts. For example:
#!/bin/bash
source ~/venv/bin/activate
cd /srv/app
python manage.py migrate
python manage.py collectstatic --noinput
At the end, gunicorn is fired:
/srv/venv/bin/gunicorn -u app -g app -b 0.0.0.0:8000 -w $WORKERS --error-logfile /srv/logs/error.log --access-logfile /srv/logs/access.log --reload app
As you can see, gunicorn looks for app.py file in /srv/app. It's standard wsgi application. Here is example for django:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "triatlon.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
If you are happy with this behaviour, you can run your app:
docker run -d --name=pyapp -p 10001:80 -v /my/site:/srv rosti/python:3.4.1
Content type
Image
Digest
sha256:d94120ead…
Size
222.6 MB
Last updated
almost 11 years ago
docker pull rosti/python