J'utilise docker 17.05.0-cs edge sur Ubuntu 17.04 Zesty. J'ai une application gunicorn/Django que j'ai construit here. Il fonctionne bien avant d'être dockerized, mais gunicorn ne peut pas voir les fichiers statiques après docker build
. Voici le Dockerfile
:Gunicorn ne trouve pas les fichiers statiques après la dockerisation
# Dockerfile
# FROM base image to build upon
FROM phusion/baseimage
# RUN install python and pip
RUN apt-get update
RUN apt-get install -y python python-pip python-dev
# ENV set environment directory tree
ENV PROJECT=mysite
ENV CONTAINER_HOME=/opt
ENV CONTAINER_PROJECT=$CONTAINER_HOME/$PROJECT
# move to project WORKDIR
WORKDIR $CONTAINER_PROJECT
# COPY project to container directory
COPY . $CONTAINER_PROJECT
# RUN pip and install requirements
RUN pip install -r requirements.txt
# COPY start.sh into known container location
COPY start.sh /start.sh
# EXPOSE port 8000 to allow communication to/from server
EXPOSE 8000
# CMD execute start.sh to start the server running.
CMD ["/start.sh"]
# done!
Les pistes d'applications et affiche la page, drôle, il applique même les modèles css
en disant qu'il ne peut pas trouver bootstrap.css
ou bootstrap.js
. Il n'exécute pas le script pour basculer le menu cependant. Les modèles actuels sont juste un artefact de ma construction initiale, les nouveaux ne vont même pas utiliser bootstrap.js
Je suis assez sûr. Il fonctionne mais la bascule ne fonctionne pas ce que je sais est une caractéristique de bootstrap.js
. Ceci est hors de la sudo docker run -it -p 8000:8000 dockerized_site
:
Starting Gunicorn.
[2017-06-07 00:38:56 +0000] [1] [INFO] Starting gunicorn 19.6.0
[2017-06-07 00:38:56 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2017-06-07 00:38:56 +0000] [1] [INFO] Using worker: sync
[2017-06-07 00:38:56 +0000] [9] [INFO] Booting worker with pid: 9
[2017-06-07 00:38:56 +0000] [10] [INFO] Booting worker with pid: 10
[2017-06-07 00:38:56 +0000] [11] [INFO] Booting worker with pid: 11
Not Found: /js/bootstrap.min.js
Not Found: /js/jquery.js
Not Found: /js/bootstrap.min.js
Not Found: /favicon.ico
I annexé le modèle d'URL de fichier statique à urls.py
, je suis assez sûr que cela a à voir avec la construction de conteneurs, ou peut-être settings.py
. Peut-être que j'ai besoin d'ajouter un répertoire d'environnement pour les fichiers statiques? Toute aide est, bien sûr, appréciée.
Pouvez-vous s'il vous plaît poster l'erreur que soulève gunicorn? – Robert