postgresql - Configuring Django with Nginx, uWSGI and Postgres on Docker -
i'm trying setup django app on docker nginx, uwsgi , postgres. found great guide on setting compose django , postgres: https://docs.docker.com/v1.5/compose/django/
however, need add nginx , uwsgi. i've tried using files of repo (https://github.com/baxeico/django-uwsgi-nginx) compose setup of docker docs without succes, sadly.
this happens when enter docker-compose run web
:
step 17 : run pip install -r /home/docker/code/app/requirements.txt ---> running in e1ec89e80d9c collecting django==1.9.1 (from -r /home/docker/code/app/requirements.txt (line 1)) /usr/local/lib/python2.7/dist-packages/pip-7.1.2-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: insecureplatformwarning: true sslcontext object not available. prevents urllib3 configuring ssl appropriately , may cause ssl connections fail. more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. insecureplatformwarning downloading django-1.9.1-py2.py3-none-any.whl (6.6mb) collecting psycopg2 (from -r /home/docker/code/app/requirements.txt (line 2)) downloading psycopg2-2.6.1.tar.gz (371kb) complete output command python setup.py egg_info: running egg_info creating pip-egg-info/psycopg2.egg-info writing pip-egg-info/psycopg2.egg-info/pkg-info writing top-level names pip-egg-info/psycopg2.egg-info/top_level.txt writing dependency_links pip-egg-info/psycopg2.egg-info/dependency_links.txt writing manifest file 'pip-egg-info/psycopg2.egg-info/sources.txt' warning: manifest_maker: standard file '-c' not found error: pg_config executable not found. please add directory containing pg_config path or specify full executable path option: python setup.py build_ext --pg-config /path/to/pg_config build ... or pg_config option in 'setup.cfg'. ---------------------------------------- command "python setup.py egg_info" failed error code 1 in /tmp/pip-build-xrgbsa/psycopg2 error: service 'web' failed build: command '/bin/sh -c pip install -r /home/docker/code/app/requirements.txt' returned non-zero code: 1
this dockerfile:
from ubuntu:precise run echo "deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted" | tee -a /etc/apt/sources.list.d/precise-updates.list # update packages run apt-get update # install required packages run apt-get install -y python python-dev python-setuptools python-software-properties run apt-get install -y sqlite3 run apt-get install -y supervisor # add nginx stable ppa run add-apt-repository -y ppa:nginx/stable # update packages after adding nginx repository run apt-get update # install latest stable nginx run apt-get install -y nginx # install pip run easy_install pip # install uwsgi because takes little while run pip install uwsgi # install our code add . /home/docker/code/ # setup configfiles run echo "daemon off;" >> /etc/nginx/nginx.conf run rm /etc/nginx/sites-enabled/default run ln -s /home/docker/code/nginx-app.conf /etc/nginx/sites-enabled/ run ln -s /home/docker/code/supervisor-app.conf /etc/supervisor/conf.d/ # run pip install run pip install -r /home/docker/code/app/requirements.txt run cd /home/docker/code/app && ./manage.py syncdb --noinput expose 80 cmd ["supervisord", "-n"]
and docker-compose.yml:
db: image: postgres web: build: . command: python vms/manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - "8000:8000" links: - db
there files named nginx-app.conf, supervisor-app.conf, uwsgi_params , uwsgi.ini. these aforementioned repo. requirements.txt contains django 1.9.1, psycopg2 , requests.
if there better alternative frankenstein project, i'd love hear it.
on ubuntu, make sure python-dev
, libpq-dev
have been installed using apt-get
, before trying install psycopg2
using pip.
see installation docs more info.
Comments
Post a Comment