项目说明
一个Django app用于注册nacos
依赖库清单
- python >= 3.6
- django >= 2.0
- requests anyversion
安装环境方式
在对应的python环境中: python setup.py install
功能及作用
1、适用于Django服务程序注册微服务实例至nacos服务中心,实现服务集群健康检测,服务弹性伸缩,压力负载均衡;
2、实现了服务与注册中心的登录授权,服务注册,心跳检测;
引入方式
以下两点同时满足后方可启动服务注册
1、在django对应settings中INSTALLED_APPS添加nacos_app
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'nacos_app.apps.NacosRegisterConfig'
]
2、django程序需要在settings环境配置中写入服务注册的信息
NACOS_SERVER_DISCOVERY = {
"server_addr": "", # nacos服务中心地址,多个英文逗号隔开
"namespace": "", # 命名空间
"group_name": "", # 分组
"ip": "", # 本机ip, 优先级低于socket请求包获取的ip
"port": "", # 本机服务端口
"service_name": "", # 本机服务名称
"ephemeral": , # 是否临时实例,true为临时实例
"username": "", # 拥有对应命名空间权限的账户
"password": "", # 密码
"heartbeat_interval": 5 # 心跳检测间隔,单位秒,nacos默认5s
}
gunicorn web服务启动
gunicorn多个worker模式下启动需要添加--preload参数,由管理进程预加载非函数式编程中的代码块,从而避免多个worker同时加载register
gunicorn backend.wsgi -w 8 -b 0.0.0.0:port -t 600 --preload
1.1.1版本构想
✓ 实现项目功能结构分离
✓ 增加查询服务列表接口功能
✓ 二次封装requests,增加支持LoadBalance的请求发送工具, 可以根据服务名名称自动查找服务ip:port
✓ 定义实体类接收数据类型
Metadata
Release files for nacos-app 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nacos_app-1.1.4.tar.gz | 5.7 kB | Without provenance | Details for nacos_app-1.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nacos_app-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for nacos_app-1.1.4-py3-none-any.whl |
Total release size: 13.5 kB
Release files / nacos_app-1.1.4.tar.gz
| Download URL | nacos_app-1.1.4.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5076a2f4708bc6b481bb357ada6e4d13badac11a2f4d0efe1783fa97b5260498
|
|
BLAKE2b-256 checksum How to use checksums |
6ed2deaee36ca9c9438aff58bfd8912767d76db9b30b46482a891fe8707dd6f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.10
|
Release files / nacos_app-1.1.4-py3-none-any.whl
| Download URL | nacos_app-1.1.4-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8decc6b3e86e39e2bdd586e2082de7b53630a7d5c740fe28db791d29db5fc48
|
|
BLAKE2b-256 checksum How to use checksums |
90fa385fef2efe5db2ec076c83fc8a5771949b78c91723b7e833560c23202b5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.10
|
Security for nacos-app 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.