我练习使用docker部署django项目
我修改了这个项目https://github.com/andrecp/django-tutorial-docker-nginx-postgres
当我访问/ docs /(swagger)时,似乎它没有加载静态文件
但我没有看到不是200的状态
我尝试了我的项目的网址有500错误
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name example.org;
access_log /dev/stdout;
error_log /dev/stdout info;
location /static {
alias /usr/src/app/static/static-only;
}
location / {
proxy_pass http://django:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}
问题怎么可能?
我不知道如何查看日志
access_log /dev/stdout;
error_log /dev/stdout info;
我尝试/dev/stdout info
但得到了许可被拒绝
nginx dockerfile:
# Set nginx base image
FROM nginx
# File Author / Maintainer
MAINTAINER Andre Prado
# Copy custom configuration file from the current directory
COPY nginx.conf /etc/nginx/nginx.conf
django dockerfile:
# Dockerfile for sample Django application
FROM python:2.7-onbuild
ENV DJANGO_CONFIGURATION Docker
RUN pip install -r /usr/src/app/requirements-test.txt
CMD ["gunicorn", "-c", "gunicorn_conf.py", "--chdir", "mysite", "mysite.wsgi:application", "--reload"]