Skip to content

dancingsnow/micro_django_demo

Repository files navigation

django-demo

操作顺序

  • 1.创建网络
    • docker network create django_demo_net
  • 2.启动数据库
    • cd dev/ 执行dev/下的compose文件
    • docker-compose up
  • 3.启动程序
    • DEBUG打开会初始化数据库,及其数据等,其他不会进行此操作
    • 执行docker-compose up

Tips:

  1. 使用gevent-server做服务器(用docker运行)
  2. drf_yasg就是为了生成swagger-ui以及对应的可视化文档,实现api操作,靠的还是rest_framework框架的序列化操作
  3. 后续的app名称,按需修改,如改为controllers,便于管理
  4. 返回值使用rest-frame的Response进行封装,
from rest_framework.response import Response  # 推荐
from django.http.response import JsonResponse, HttpResponse # 可以序列化成功,不影响正常使用,但是日志中间件会无法成功捕获
  1. 静态文件handler,全部打开,不受DEBUG=True限制

About

基于Django+swagger构建的微服务模板demo,用于快速构建服务

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy