A boilerplate to deploy Django with cool stuff. Also serves as an example project from these tutorial:
Where it is described how this boilerplate was created from scratch so that you can build your own.
Dockerfile
.In the Dockerfile
, there are detailed instructions on how to install data science dependencies.
PS: Here is a gist
which is more useful for Numpy, Pandas, Scipy etc. And it is usable with this project's docker-compose.yml
file. Just you need to replace the Dockerfile
from ./compose directory with the one in the gist.
make build
inside root directory.make up
to start up the project for first time..envs
folder.Checkout the commands section for more usage.
A default Django project resides in src
directory. So, when you start the project, you will see the following screen in 8000
port:
Also when you access the django container log via make log-web
, you will see the following:
To use this project, run this commands:
make up
to build the project and starting containers.make build
to build the project.make start
to start containers if project has been up already.make stop
to stop containers.make shell-web
to shell access web container.make shell-db
to shell access db container.make shell-nginx
to shell access nginx container.make logs-web
to log access web container.make logs-db
to log access db container.make logs-nginx
to log access nginx container.make collectstatic
to put static files in static directory.make log-web
to log access web container.make log-db
to log access db container.make log-nginx
to log access nginx container.make restart
to restart containers.MIT.
Feel free to fork and create PR.
1、定制一个镜像 dockerfile文件内容: #基于的基础镜像 FROM python #设置ipdivide文件夹是工作目录 WORKDIR ./ipdivide #更新apt-get并安装ping命令 RUN apt-get update && apt-get install iputils-ping #代码添加到 . 文件夹 ADD . . #安装支持 RUN pip install -
由于Docker官方提供的Django很久都没有更新 所以使用官方的python镜像,在此基础上再安装django和uwsgi 注意:一定要声明端口,因为使用其他容器如nginx时,需要访问到 FROM python:3.6.4-stretch RUN pip install django uwsgi; EXPOSE 80 另外使用官方的nginx镜像,将两个容器一起运行 整个流程是 客户
后端 uwsgi.ini [uwsgi] socket=0.0.0.0:6061 # 为所有的socket操作设置内部超时时间(默认4秒)。这个配置会结束那些处于不活动状态超过4秒的连接 socket-timeout=4 listen=2048 processes=4 threads = 2 enable-threads=true master=true pidfile=/var/log/jojo
个人项目实际部署过程: 复制链接或者点这里 https://note.youdao.com/s/Wm4Qhv9G 此次部署是在Ubuntu系统部署,部署使用的方式是容器挂载宿主机代码目录,宿主机代码更新后,容器也会实时更新。 附 部署过程中可能会用的docker命令: docker ps 查看正在运行的容器 docker pa -a 查看所有容器 docker images 查看镜像 dockce
An example Django + Docker app You could use this example app as a base for your new project or as a guide toDockerize your existing Django app. The example app is minimal but it wires up a number of
Dockerizing Django with Postgres, Gunicorn, and Nginx Want to learn how to build this? Check out the post. Want to use this project? Development Uses the default Django development server. Rename .env
一、解决的问题 二、与虚拟机的比较 三、优势 四、使用场景 五、镜像与容器 参考资料 一、解决的问题 由于不同的机器有不同的操作系统,以及不同的库和组件,在将一个应用部署到多台机器上需要进行大量的环境配置操作。 Docker 主要解决环境配置问题,它是一种虚拟化技术,对进程进行隔离,被隔离的进程独立于宿主操作系统和其它隔离的进程。使用 Docker 可以不修改应用程序代码,不需要开发人员学习特定环
我检查了垃圾箱,里面没有ping
第一章 Docker介绍1 1.1 docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的\[Linux\]机器上,也可以实现\[虚拟化\]。容器是完全使用\[沙箱\]机制,相互之间不会有任何接口。 1.2 Docker是什么? Docker是一个程序运行、测试、交付的开放平台,Docker被设计为能够使你快速地交
推荐使用 Swoole 官方 Docker:https://github.com/swoole/docker-swoole