8000 GitHub - hongweifuture/Django-Blog: 基于 Python 的 Web 框架 Django 开发的博客系统,采用 Docker + Django + MySQL + Nginx + Gunicorn 进行容器化部署。
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

基于 Python 的 Web 框架 Django 开发的博客系统,采用 Docker + Django + MySQL + Nginx + Gunicorn 进行容器化部署。

Notifications You must be signed in to change notification settings

hongweifuture/Django-Blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

说明

Django 是使用 Python 编写的一个开源 Web 框架,采用 MVC 的软件设计模式,可以用它来快速搭建一个高性能的网站。

目前:

  • 基于 windowsDjango 1.11 开发,已完成
  • 基于 macOS Catalina 10.15Django2.2 LTS 开发,已完成,由 1.11 升级并修改
  • 模板:基于 Bootstarp V4jQuery 的主题修改为所需模板,使用 FBV,这个改的太多了
  • 模型:对 ORM 新的认识,优化需求,替换为 MySQL
  • 搜索:django-haystack + whoosh + jieba 分词的方案,解决中文问题
  • 翻页:基于模板语言和自定义标签解决文章删除id跳跃、首尾页显示问题
  • 后台:由 xadmin 换为 simpleui,简单复写页面
  • 部署: docker + docker-compose 容器化部署,自动备份
  • 展望:评论功能, 缓存功能,第三方登录暂不提供,django-restframework + Vue 前后端分离开发方案,提供 Restful API

docker环境

部署

下载

git clone https://github.com/hongweifuture/Django-Blog

运行 django 2.2.8 (默认)

docker-compose up -d

运行 django 1.11.26

更改

  1. docker-compose.ymlwebsiteDocker Image 标签版本号
  2. diango-1.11.26 文件夹改名为 diango, 原 diango 文件夹更名
...

  website:
    image: hwnet/hw-website:1.11.26
    container_name: hw_django
...

运行

docker-compose up -d

创建后台管理员

docker-compose run website python manage.py createsuperuser

停止

docker-compose down

备份

定时备份

sh migrate.sh -t "0 3 * * *"

手动备份

sh migrate.sh -b

手动清理

sh migrate.sh -c

恢复备份

sh migrate.sh -r *.sql.gz *.tar.gz

访问

首页

默认port9000,如需80,请修改 docker-compose.ymlnginx 的宿主机映射端口

  ...
  
  nginx:
    ...
    ports:
      - "80:8000"
      
  ...

后台

IP:Port/administrator

参考

问题

Docker内网络或外网连接不上,请检查服务器的安全组或者防火墙

腾讯云设置安全组放行9000端口

Google Cloud 需设置防火墙

  • 放通内网
  • 设置出入站规则

About

基于 Python 的 Web 框架 Django 开发的博客系统,采用 Docker + Django + MySQL + Nginx + Gunicorn 进行容器化部署。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0