当前位置: 首页 > 软件库 > 数据库相关 > >

docker-django

授权协议 MIT License
开发语言 C/C++
所属分类 数据库相关
软件类型 开源软件
地区 不详
投 递 者 赏弘
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Deploy Django using Nginx, Celery, Redis and Postgresql with Docker

A boilerplate to deploy Django with cool stuff. Also serves as an example project from these tutorial:

  1. Deploy Django, Gunicorn, NGINX, Postgresql using Docker
  2. Serve Static Files by Nginx from Django using Docker
  3. Docker: Use Celery in Django(Redis as Broker)

Where it is described how this boilerplate was created from scratch so that you can build your own.

Advantages

  1. Ready to use with your django project.
  2. Combined with NGINX, Redis, Celery to handle relevent things.
  3. Alpine based images are used, so that sizes of the images are compartively low.
  4. Now comes built it with Numpy, Scipy and Pandas support. So you can integrate your datascience projects with this. Instructions for integrating these libraries are also shared in the Dockerfile.
  5. With Numpy, Pandas and Scipy dependecies installed, the total size is 657MB(may differ if you have more packages). Without these, size reduces to 390MB.
  6. Now comes with support to install Pillow using django.

Now Featuring Numpy, Scipy and Pandas

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.

Basic Usage

  1. First run make build inside root directory.
  2. Then run make up to start up the project for first time.
  3. Use/update environment variables from .envs folder.

Checkout the commands section for more usage.

Preview

A default Django project resides in src directory. So, when you start the project, you will see the following screen in 8000 port:

Demo One

Also when you access the django container log via make log-web, you will see the following:

Demo Two

Commands

To use this project, run this commands:

  1. make up to build the project and starting containers.
  2. make build to build the project.
  3. make start to start containers if project has been up already.
  4. make stop to stop containers.
  5. make shell-web to shell access web container.
  6. make shell-db to shell access db container.
  7. make shell-nginx to shell access nginx container.
  8. make logs-web to log access web container.
  9. make logs-db to log access db container.
  10. make logs-nginx to log access nginx container.
  11. make collectstatic to put static files in static directory.
  12. make log-web to log access web container.
  13. make log-db to log access db container.
  14. make log-nginx to log access nginx container.
  15. make restart to restart containers.

License

MIT.

Contribute

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