{"id":19150967,"url":"https://github.com/hequan2017/seal","last_synced_at":"2025-07-28T19:09:29.341Z","repository":{"id":39721551,"uuid":"173327874","full_name":"hequan2017/seal","owner":"hequan2017","description":"django-base-templates 主要为 django 开发DEMO, 支持 非前后端分离 和 前后端分离模式 。","archived":false,"fork":false,"pushed_at":"2023-02-15T21:00:19.000Z","size":46017,"stargazers_count":126,"open_issues_count":13,"forks_count":68,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-08T06:42:53.942Z","etag":null,"topics":["cmdb","dev","devops","django","goinception","graphql","graphql-django","iview","iview-admin","kubernetes","kubernetes-dashboard","ops","python","python3","restful","restful-api","soar","sql","vue","webssh"],"latest_commit_sha":null,"homepage":"https://github.com/hequan2017/seal","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hequan2017.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-01T15:48:17.000Z","updated_at":"2024-12-09T06:19:08.000Z","dependencies_parsed_at":"2023-02-17T14:31:04.788Z","dependency_job_id":null,"html_url":"https://github.com/hequan2017/seal","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hequan2017/seal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fseal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fseal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fseal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fseal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hequan2017","download_url":"https://codeload.github.com/hequan2017/seal/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hequan2017%2Fseal/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267569841,"owners_count":24109148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmdb","dev","devops","django","goinception","graphql","graphql-django","iview","iview-admin","kubernetes","kubernetes-dashboard","ops","python","python3","restful","restful-api","soar","sql","vue","webssh"],"created_at":"2024-11-09T08:13:27.771Z","updated_at":"2025-07-28T19:09:24.322Z","avatar_url":"https://github.com/hequan2017.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 海豹  \n![版本](https://img.shields.io/badge/release-0.3-blue.svg)\n![语言](https://img.shields.io/badge/language-python3.6-blue.svg)\n![语言](https://img.shields.io/badge/env-django2.2-red.svg)\n![bootstrap3](https://img.shields.io/badge/model-bootstrap3-mauve.svg)\n![RESTful](https://img.shields.io/badge/api-RESTful-blue.svg)\n![GraphQL](https://img.shields.io/badge/api-GraphQL-blue.svg)\n\n\u003e django-base-templates\n\n\u003e 因本项目开始时间为3月1日,是 国际海豹日,故项目起名为  海豹 seal \n\n\u003e 主要为 django 基础开发平台, MVC 模式 开发.支持 非前后端分离 和 前后端分离模式,可以拿来参考 开发 django项目\n\n\u003e 支持 RESTful 和 GraphQL\n\n\u003e 作者会在周末进行开发、更新。\n\n\u003e 支持 k8s webssh 管理 pod！ sql执行 ！\n\n \n## 介绍\n* 基于bootstrap3+django2.2 + python3.6+celery4 异步任务\n* 前端模板 inspinia 2.7 \n* 采用cbv开发方式\n* drf  RESTful  api 例子\n* 前端 Vue版本\n* GraphQL\n* k8s管理  \n* sql执行 引擎  goInception / soar\n\n\n## 开发计划\n\n*  一期: 基础模板 (已完成)\n*  二期: k8s管理平台 (开发中)\n    * node/service/pod   列表   (已完成)  \n    * pod   webssh (已完成， 通过调用 k8s api 进行执行命令)  \n*  三期: mysql sql语句审核(已完成)\n    * sql检测执行\n*  四期:正在开发中 　重构前端　https://github.com/hequan2017/seal-d2-admin\n    \n    \n## DEMO\n\n\u003e http://129.28.156.219:8001\n\n\u003e 账户 admin    密码 1qaz.2wsx\n\n\u003e api文档地址 : http://129.28.156.219:8001/api/docs/\n\n\u003e vue 前端地址1  \u003chttps://github.com/hequan2017/seal-vue\u003e 持续开发中\n\n![列表](document/demo/1.jpg)\n![添加](document/demo/2.jpg)\n![API](document/demo/3.jpg)\n![API](document/demo/4.jpg)\n![API](document/demo/5.jpg)\n![K8S](document/demo/6.jpg)\n![K8S](document/demo/7.jpg)\n![SQL](document/demo/8.jpg)\n\n## templates\n\n* base      网页基本模板\n* system    平台基本网页(首页/登录/修改密码)\n* assets    资产管理  (增删改查例子)\n* document  代码规范\n\n\n## GraphQL\n\u003e 具体代码 请参考  seal/schema.py\n\n\u003e 请求地址 :  \u003chttp://localhost/graphql\u003e\n\n\u003e GraphQL 请求参数\n```\nquery{\n  users{\n    id,\n    username,\n    email\n  }\n}\n\nquery{\n  singleUser(pk: 1){\n    username,\n    email\n  }\n}\n\nmutation createUser {\n createUser (username: \"test1\") {\n     info {\n         id,\n     },\n     ok\n }\n}\n\nmutation updateUser {\n updateUser (pk:2,username: \"test2\") {\n     info {\n         id,\n     },\n     ok\n }\n}\n\nmutation deleteUser {\n deleteUser (pk:2) {\n     ok\n }\n}\n```\n\n\n## 部署\n* mysql 5.7 / sqlite\n* redis\n\n```bash\nyum install  python-devel mysql-devel  python36-devel.x86_64  -y\n\ngit clone https://github.com/hequan2017/seal\ncd seal\n\n## django 2.2 不支持 低版本的 sqlite,如果想使用sqlite  存储数据 ，请根据这个博客 https://www.jianshu.com/p/cdacf4b74646 进行升级\n\npython36  -m  pip  install -r requirements.txt\npython36 manage.py makemigrations\npython36 manage.py migrate\npython36 manage.py createsuperuser\n\n\npython36  manage.py  runserver 0.0.0.0:8001\n\n//\nnohup  python36  manage.py  runserver 0.0.0.0:8001  \u003e\u003e  /tmp/http.log   2\u003e\u00261  \u0026 \n\n\n```\n\n## k8s模块\n\n\u003e 修改settings  k8s 相关设置\n```\n## K8S\nToken = \"eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tZGhobWMiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiOThkMDcwZWItODc1Yy0xMWU5LWE1MzgtMDAwYzI5N2I0ZmU3Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.XDFpez2E84R_zlopt_uEHPvVGUtSavypyix6UcYJO3J4imHdJy7MEkfV-wltBA1H8x0TT2AW64rLlXaRJ8OkFWJ0myedfKdjnf7i0oLQ8j-7lw6rT3A0e2pKmpnOaBQfgzRm83-t2I5MMp3Iu9VNUiAbqQpjql4AKwRuJEEGCs99tKStUxzIsJKusmUHh9KAK4BAxySn9h16T2URZ7czLP4mty2crYWNV4KwSwFPthGhFPsl8mnet_hiV5k4me5a8frmXytOy64MmGW8w3TBgiM-7hBYSxt84QGGnyi84LU0EFgtLwBWEOTZeUKKQ6IkoAprMmNcSxX8WUJFlx_uJg\"\nAPISERVER = 'https://192.168.100.111:6443'\n```\n\n\n## SQL模块\n\n\u003e 进入项目 cd  seal\n\n\u003e sql/bin/config/config.toml 里面可以设置备份服务器，详情可以  github搜索   goInception\n```\nchmod +x sql/bin/soar\n\nchmod +x sql/bin/goInception\n\n./sql/bin/goInception -config=sql/bin/config/config.toml\n```\n\n\n## 异步任务\n\n\n* 扩展功能-异步1   推荐 定时任务用celery\n\n```bash\n\ncd seal\ncelery  -B   -A  seal  worker  -l  info\n```\n\n* 扩展功能-异步2   普通异步任务 用  dramatiq\n```bash\ncd system/decorator/asynchronous/\ndramatiq  asynchronous  --watch  .  --log-file  /tmp/dramatiq.log\n\n```\n\n\n##  注意\n* 如果想直接拿来做生产项目,请重新生成一个 settings 文件里面的 SECRET_KEY \n* 时区问题\n```python\n##因为开启了时区,所以django在数据库里面保存的为 utc 时间, 调用的时候会帮你 转为 东八区, celery会自动识别时间\nfrom django.utils import timezone\nfor i in Users.objects.all():\n    print(i.last_login)  ## 直接读取时间,会是 utc时间,未转换, 如果需要处理 请注意\n    print(timezone.localtime(i.last_login).strftime(\"%Y-%m-%d %H:%M:%S\"))  ## 时间格式化为 正常时间\n    \n## 2019-03-05 06:41:18.040809+00:00\n## 2019-03-05 14:41:18\n\n```\n\n\n## 售后服务\n\n* cbv 中文文档  \u003chttp://ccbv.co.uk/projects/Django/2.1/django.views.generic.edit/\u003e\n* GraphQL   中文参考文档  \u003chttps://passwo.gitbook.io/graphql/index/drf\u003e\n\n### 其他\n* 有问题 可以加QQ群： 620176501  \u003ca target=\"_blank\" href=\"//shang.qq.com/wpa/qunwpa?idkey=bbe5716e8bd2075cb27029bd5dd97e22fc4d83c0f61291f47ed3ed6a4195b024\"\u003e\u003cimg border=\"0\" src=\"https://github.com/hequan2017/cmdb/blob/master/static/img/group.png\"  alt=\"django开发讨论群\" title=\"django开发讨论群\"\u003e\u003c/a\u003e\n* 欢迎提出你的需求和意见,或者来加入到本项目中一起开发。\n\n### 作者\n* 何全 \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fseal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhequan2017%2Fseal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhequan2017%2Fseal/lists"}