xadmin与django-rest-framework的集成(1)
什么是xadmin?什么是django-rest-framework?
xadmin是开源的一个类似于django自带的后台管理系统admin的开源模块,它基于bootstrap3框架,内置强大的插件系统,根据项目需求可以自定义扩展,它比admin功能更加丰富,更加便于我们项目的开发。
关于django-rest-framework是基于restful API标准而开发的一套针对django框架的api框架,作为目前流行的前后端分离架构,django-rest-framework通过强大的标准api接口,以及api文档自动撰写功能等对我们后端项目开发就是一种福音.
搭建开发环境
本次演示基于python3.6,django2.0(目前xadmin已经支持django2.0+)
创建虚拟环境并激活进入虚拟环境
virtualenv xadminenv
source xadminenv/bin/active
进入python环境可以看到,我们虚拟环境默认安装的python环境为3.6的
安装django,这里我们加上豆瓣源,https://pypi.douban.com/simple/
pip3 install -i https://pypi.douban.com/simple/ django
使用pip list命令可以看到,我使用的django为2.0版本
创建项目
创建项目目录
django-admin startproject myproj
项目结构如下:
myproj /
manage.py
myproj /
__init__ .py
setting.py
url.py
wsgi.PY
关于django的其它用法见我的关于django使用的文章,这里我们着重研究xadmin的使用
下面几步仅仅是为了演示需求
我们创建几个应用
python manage.py startapp users
python manage.py startapp trade
python manage.py startapp goods
python manage.py startapp user_operateion
我们在manage.py同级创建一个apps的文件夹用于存放我们的各个应用,同时创建一个extra_apps用于存放第三方包,将我们的应用放入相应的包
settings.py配置
import os
import sys # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(,os.path.join(BASE_DIR,'apps')) #将应用包加入系统变量,便于模块导入
sys.path.insert(,os.path.join(BASE_DIR,'extra_apps')) # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ')57n02l@w9p9)g(47pcp6+uofk$&-a_eqburb%r2n$#w751^fa' # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users', #注册app
'goods',
'trade',
'user_operation',
]
一切就绪,编写我们的model
users/models.py
from datetime import datetime from django.db import models
from django.contrib.auth.models import AbstractUser # Create your models here. class UserProfile(AbstractUser):
"""
用户
"""
name = models.CharField(max_length=, null=True, blank=True, verbose_name="姓名")
birthday = models.DateField(null=True, blank=True, verbose_name="出生年月")
gender = models.CharField(max_length=, choices=(("male", u"男"), ("female", "女")), default="female", verbose_name="性别")
mobile = models.CharField(null=True, blank=True, max_length=, verbose_name="电话")
email = models.EmailField(max_length=, null=True, blank=True, verbose_name="邮箱") class Meta:
verbose_name = "用户"
verbose_name_plural = verbose_name def __str__(self):
return self.username class VerifyCode(models.Model):
"""
短信验证码
"""
code = models.CharField(max_length=, verbose_name="验证码")
mobile = models.CharField(max_length=, verbose_name="电话")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "短信验证码"
verbose_name_plural = verbose_name def __str__(self):
return self.code
goos/models.py
from datetime import datetime from django.db import models
from DjangoUeditor.models import UEditorField
# Create your models here. class GoodsCategory(models.Model):
"""
商品类别
"""
CATEGORY_TYPE = (
(, "一级类目"),
(, "二级类目"),
(, "三级类目"),
) name = models.CharField(default="", max_length=, verbose_name="类别名", help_text="类别名")
code = models.CharField(default="", max_length=, verbose_name="类别code", help_text="类别code")
desc = models.TextField(default="", verbose_name="类别描述", help_text="类别描述")
category_type = models.IntegerField(choices=CATEGORY_TYPE, verbose_name="类目级别", help_text="类目级别")
parent_category = models.ForeignKey("self", null=True, blank=True, verbose_name="父类目级别", help_text="父目录",
related_name="sub_cat",on_delete=models.CASCADE)
is_tab = models.BooleanField(default=False, verbose_name="是否导航", help_text="是否导航")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "商品类别"
verbose_name_plural = verbose_name def __str__(self):
return self.name class GoodsCategoryBrand(models.Model):
"""
品牌名
"""
category = models.ForeignKey(GoodsCategory, related_name='brands', null=True, blank=True, verbose_name="商品类目",on_delete=models.CASCADE)
name = models.CharField(default="", max_length=, verbose_name="品牌名", help_text="品牌名")
desc = models.TextField(default="", max_length=, verbose_name="品牌描述", help_text="品牌描述")
image = models.ImageField(max_length=, upload_to="brands/")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "品牌"
verbose_name_plural = verbose_name
db_table = "goods_goodsbrand" def __str__(self):
return self.name class Goods(models.Model):
"""
商品
"""
category = models.ForeignKey(GoodsCategory, verbose_name="商品类目",on_delete=models.CASCADE)
goods_sn = models.CharField(max_length=, default="", verbose_name="商品唯一货号")
name = models.CharField(max_length=, verbose_name="商品名")
click_num = models.IntegerField(default=, verbose_name="点击数")
sold_num = models.IntegerField(default=, verbose_name="商品销售量")
fav_num = models.IntegerField(default=, verbose_name="收藏数")
goods_num = models.IntegerField(default=, verbose_name="库存数")
market_price = models.FloatField(default=, verbose_name="市场价格")
shop_price = models.FloatField(default=, verbose_name="本店价格")
goods_brief = models.TextField(max_length=, verbose_name="商品简短描述")
goods_desc = UEditorField(verbose_name=u"内容", imagePath="goods/images/", width=, height=,
filePath="goods/files/", default='')
ship_free = models.BooleanField(default=True, verbose_name="是否承担运费")
goods_front_image = models.ImageField(upload_to="goods/images/", null=True, blank=True, verbose_name="封面图")
is_new = models.BooleanField(default=False, verbose_name="是否新品")
is_hot = models.BooleanField(default=False, verbose_name="是否热销")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = '商品'
verbose_name_plural = verbose_name def __str__(self):
return self.name class IndexAd(models.Model):
category = models.ForeignKey(GoodsCategory, related_name='category',verbose_name="商品类目",on_delete=models.CASCADE)
goods =models.ForeignKey(Goods, related_name='goods',on_delete=models.CASCADE) class Meta:
verbose_name = '首页商品类别广告'
verbose_name_plural = verbose_name def __str__(self):
return self.goods.name class GoodsImage(models.Model):
"""
商品轮播图
"""
goods = models.ForeignKey(Goods, verbose_name="商品", related_name="images",on_delete=models.CASCADE)
image = models.ImageField(upload_to="", verbose_name="图片", null=True, blank=True)
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = '商品图片'
verbose_name_plural = verbose_name def __str__(self):
return self.goods.name class Banner(models.Model):
"""
轮播的商品
"""
goods = models.ForeignKey(Goods, verbose_name="商品",on_delete=models.CASCADE)
image = models.ImageField(upload_to='banner', verbose_name="轮播图片")
index = models.IntegerField(default=, verbose_name="轮播顺序")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = '轮播商品'
verbose_name_plural = verbose_name def __str__(self):
return self.goods.name class HotSearchWords(models.Model):
"""
热搜词
"""
keywords = models.CharField(default="", max_length=, verbose_name="热搜词")
index = models.IntegerField(default=, verbose_name="排序")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = '热搜词'
verbose_name_plural = verbose_name def __str__(self):
return self.keywords
trade/models.py
from datetime import datetime from django.db import models
from django.contrib.auth import get_user_model from goods.models import Goods
User = get_user_model()
# Create your models here. class ShoppingCart(models.Model):
"""
购物车
"""
user = models.ForeignKey(User, verbose_name=u"用户",on_delete=models.CASCADE)
goods = models.ForeignKey(Goods, verbose_name=u"商品",on_delete=models.CASCADE)
nums = models.IntegerField(default=, verbose_name="购买数量") add_time = models.DateTimeField(default=datetime.now, verbose_name=u"添加时间") class Meta:
verbose_name = '购物车'
verbose_name_plural = verbose_name
unique_together = ("user", "goods") def __str__(self):
return "%s(%d)".format(self.goods.name, self.nums) class OrderInfo(models.Model):
"""
订单
"""
ORDER_STATUS = (
("TRADE_SUCCESS", "成功"),
("TRADE_CLOSED", "超时关闭"),
("WAIT_BUYER_PAY", "交易创建"),
("TRADE_FINISHED", "交易结束"),
("paying", "待支付"),
) user = models.ForeignKey(User, verbose_name="用户",on_delete=models.CASCADE)
order_sn = models.CharField(max_length=, null=True, blank=True, unique=True, verbose_name="订单号")
trade_no = models.CharField(max_length=, unique=True, null=True, blank=True, verbose_name=u"交易号")
pay_status = models.CharField(choices=ORDER_STATUS, default="paying", max_length=, verbose_name="订单状态")
post_script = models.CharField(max_length=, verbose_name="订单留言")
order_mount = models.FloatField(default=0.0, verbose_name="订单金额")
pay_time = models.DateTimeField(null=True, blank=True, verbose_name="支付时间") # 用户信息
address = models.CharField(max_length=, default="", verbose_name="收货地址")
signer_name = models.CharField(max_length=, default="", verbose_name="签收人")
singer_mobile = models.CharField(max_length=, verbose_name="联系电话") add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = u"订单"
verbose_name_plural = verbose_name def __str__(self):
return str(self.order_sn) class OrderGoods(models.Model):
"""
订单的商品详情
"""
order = models.ForeignKey(OrderInfo, verbose_name="订单信息", related_name="goods",on_delete=models.CASCADE)
goods = models.ForeignKey(Goods, verbose_name="商品",on_delete=models.CASCADE)
goods_num = models.IntegerField(default=, verbose_name="商品数量") add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "订单商品"
verbose_name_plural = verbose_name def __str__(self):
return str(self.order.order_sn)
user_operation/models.py
from datetime import datetime from django.db import models
from django.contrib.auth import get_user_model from goods.models import Goods
# Create your models here.
User = get_user_model() class UserFav(models.Model):
"""
用户收藏
"""
user = models.ForeignKey(User, verbose_name="用户",on_delete=models.CASCADE)
goods = models.ForeignKey(Goods, verbose_name="商品", help_text="商品id",on_delete=models.CASCADE)
add_time = models.DateTimeField(default=datetime.now, verbose_name=u"添加时间") class Meta:
verbose_name = '用户收藏'
verbose_name_plural = verbose_name
unique_together = ("user", "goods") def __str__(self):
return self.user.username class UserLeavingMessage(models.Model):
"""
用户留言
"""
MESSAGE_CHOICES = (
(, "留言"),
(, "投诉"),
(, "询问"),
(, "售后"),
(, "求购")
)
user = models.ForeignKey(User, verbose_name="用户",on_delete=models.CASCADE)
message_type = models.IntegerField(default=, choices=MESSAGE_CHOICES, verbose_name="留言类型",
help_text=u"留言类型: 1(留言),2(投诉),3(询问),4(售后),5(求购)")
subject = models.CharField(max_length=, default="", verbose_name="主题")
message = models.TextField(default="", verbose_name="留言内容", help_text="留言内容")
file = models.FileField(upload_to="message/images/", verbose_name="上传的文件", help_text="上传的文件")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "用户留言"
verbose_name_plural = verbose_name def __str__(self):
return self.subject class UserAddress(models.Model):
"""
用户收货地址
"""
user = models.ForeignKey(User, verbose_name="用户" ,on_delete=models.CASCADE)
province = models.CharField(max_length=, default="", verbose_name="省份")
city = models.CharField(max_length=, default="", verbose_name="城市")
district = models.CharField(max_length=, default="", verbose_name="区域")
address = models.CharField(max_length=, default="", verbose_name="详细地址")
signer_name = models.CharField(max_length=, default="", verbose_name="签收人")
signer_mobile = models.CharField(max_length=, default="", verbose_name="电话")
add_time = models.DateTimeField(default=datetime.now, verbose_name="添加时间") class Meta:
verbose_name = "收货地址"
verbose_name_plural = verbose_name def __str__(self):
return self.address
模型编写完成,设置一下我们的数据库配置,我这里使用mysql
myproj/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'myproj',
'USER':'root',
'PASSWORD':'',
'HOST':'localhost',
'POSRT':'',
'OPTIONS': {
'init_command': 'SET default_storage_engine=INNODB',
}
}
}
AUTH_USER_MODEL = 'users.UserProfile' #由于我们在users/models.py继承了django的AbstractUser,所以需要在settings.py中指定我们自定义的user模型,否则创建模型会报E304错误
执行以下命令,生成我们的数据库迁移脚本并生成数据库模型
python manage.py makemigrations
python mange.py migrate
如果报错,显示以下错误信息
因为我们未安装数据库连接驱动
pip3 install -i https://pypi.douban.com/simple/ mysqlclient
编辑myproj/__init__.py
import pymysql pymysql.install_as_MySQLdb() #因为mysqldb不支持3.5及以上版本,这里我们使用pymysql,这句话意思是将pymysql包传入mysqldb进行初始化
此时仍然报错,因为我们在创建goods/models.py里面的模型时候,使用了DjangoUeditorapp,但我们实际上还未导入这个包,因为这个属于第三方包,我们使用源码导入,并将其放置在extra_apps目录下,源码下载路径:http://ueditor.baidu.com/website/
在myproj/settings.py中注册此app
此时再执行数据库迁移命令,如下
此时,数据库迁移模型已经生成,我们只需再执行migrate命令同步数据库即可
此时数据库中已经有我们的数据表模型了
以上步骤都完成以后就可以开始着手创建系统管理后台了,关于django自带的admin这里不再阐述,我们直接开始xadmin的集成
xadmin的集成
导入xadmin,这里我们选择源码导入,https://github.com/sshwsfc/xadmin/tree/django2下载django2对应的源码到本地,将xadmin文件夹整体拷贝到我们的extra_apps目录下,并在settings.py文件中注册
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'users', #注册app
'goods',
'trade',
'user_operation',
'DjangoUeditor',
'xadmin' #注册xadmin
]
根据xadmin源码,由于xadmin模块需要依赖其它包,我们在这里一一安装
pip3 install -i https://pypi.douban.com/simple/ django-crispy-forms>=1.6.0 django-import-export>=0.5.1 django-reversion>=2.0.0 django-formtools==2.0 future==0.15.2 httplib2==0.9.2 six==1.10.0
在settings.py中注册crispy_forms
创建超级管理员
python manage.py createsuperuser
配置xadminurl
import xadmin urlpatterns = [
# url('admin/', admin.site.urls),
re_path(r'xadmin/',xadmin.site.urls)
]
配置完之后,需要同步以下数据库,生成xadmin需要的数据库表
此时,运行项目,访问,localhost:8000/xadmin
至此,我们的xadmin后台就初步搭建完成了,下面我们注册我们的各个app项目
在之前apps下面的app中分别创建adminx.py文件,里面用来定义xadmin的定制类
users/adminx.py
#!/usr/bin/env python
# encoding: utf- import xadmin
from xadmin import views
from .models import VerifyCode class BaseSetting(object):
enable_themes = True
use_bootswatch = True class GlobalSettings(object):
site_title = "后台管理" #设置头标题
site_footer = "shopping center" #设置脚标题
# menu_style = "accordion" class VerifyCodeAdmin(object):
list_display = ['code', 'mobile', "add_time"] xadmin.site.register(VerifyCode, VerifyCodeAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
goos/adminx.py
#!/usr/bin/env python
# encoding: utf-
import xadmin
from .models import Goods, GoodsCategory, GoodsImage, GoodsCategoryBrand, Banner, HotSearchWords
from .models import IndexAd class GoodsAdmin(object):
list_display = ["name", "click_num", "sold_num", "fav_num", "goods_num", "market_price",
"shop_price", "goods_brief", "goods_desc", "is_new", "is_hot", "add_time"]
search_fields = ['name', ]
list_editable = ["is_hot", ]
list_filter = ["name", "click_num", "sold_num", "fav_num", "goods_num", "market_price",
"shop_price", "is_new", "is_hot", "add_time", "category__name"]
style_fields = {"goods_desc": "ueditor"} class GoodsImagesInline(object):
model = GoodsImage
exclude = ["add_time"]
extra =
style = 'tab' inlines = [GoodsImagesInline] class GoodsCategoryAdmin(object):
list_display = ["name", "category_type", "parent_category", "add_time"]
list_filter = ["category_type", "parent_category", "name"]
search_fields = ['name', ] class GoodsBrandAdmin(object):
list_display = ["category", "image", "name", "desc"] def get_context(self):
context = super(GoodsBrandAdmin, self).get_context()
if 'form' in context:
context['form'].fields['category'].queryset = GoodsCategory.objects.filter(category_type=)
return context class BannerGoodsAdmin(object):
list_display = ["goods", "image", "index"] class HotSearchAdmin(object):
list_display = ["keywords", "index", "add_time"] class IndexAdAdmin(object):
list_display = ["category", "goods"] xadmin.site.register(Goods, GoodsAdmin)
xadmin.site.register(GoodsCategory, GoodsCategoryAdmin)
xadmin.site.register(Banner, BannerGoodsAdmin)
xadmin.site.register(GoodsCategoryBrand, GoodsBrandAdmin) xadmin.site.register(HotSearchWords, HotSearchAdmin)
xadmin.site.register(IndexAd, IndexAdAdmin)
trade/adminx.py
# -*- coding: utf- -*-
__author__ = 'bobby' import xadmin
from .models import ShoppingCart, OrderInfo, OrderGoods class ShoppingCartAdmin(object):
list_display = ["user", "goods", "nums", ] class OrderInfoAdmin(object):
list_display = ["user", "order_sn", "trade_no", "pay_status", "post_script", "order_mount",
"order_mount", "pay_time", "add_time"] class OrderGoodsInline(object):
model = OrderGoods
exclude = ['add_time', ]
extra =
style = 'tab' inlines = [OrderGoodsInline, ] xadmin.site.register(ShoppingCart, ShoppingCartAdmin)
xadmin.site.register(OrderInfo, OrderInfoAdmin)
user_operation/adminx.py
#!/usr/bin/env python
# encoding: utf-
import xadmin
from .models import UserFav, UserLeavingMessage, UserAddress class UserFavAdmin(object):
list_display = ['user', 'goods', "add_time"] class UserLeavingMessageAdmin(object):
list_display = ['user', 'message_type', "message", "add_time"] class UserAddressAdmin(object):
list_display = ["signer_name", "signer_mobile", "district", "address"] xadmin.site.register(UserFav, UserFavAdmin)
xadmin.site.register(UserAddress, UserAddressAdmin)
xadmin.site.register(UserLeavingMessage, UserLeavingMessageAdmin)
到此,我们的项目app都已经集成到xadmin后台中,至于xadmin自定义字段表示的意思,可以查询相关文档
xadmin与django-rest-framework的集成(1)的更多相关文章
- [Django REST framework - RBAC-基于角色的访问控制、base64编码 、xadmin的使用]
[Django REST framework - RBAC-基于角色的访问控制.base64编码 .xadmin的使用] RBAC-基于角色的访问控制 RBAC 是基于角色的访问控制(Role-Bas ...
- Django REST framework+Vue 打造生鲜超市(一)
一.项目介绍 1.1.掌握的技术 Vue + Django Rest Framework 前后端分离技术 彻底玩转restful api 开发流程 Django Rest Framework 的功能实 ...
- Django REST framework+Vue 打造生鲜超市(四)
五.商品列表页 5.1.django的view实现商品列表页 (1)goods/view_base.py 在goods文件夹下面新建view_base.py,为了区分django和django res ...
- 3- vue django restful framework 打造生鲜超市 - model设计和资源导入
3- vue django restful framework 打造生鲜超市 - model设计和资源导入 使用Python3.6与Django2.0.2(Django-rest-framework) ...
- 1- vue django restful framework 打造生鲜超市
Vue+Django REST framework实战 使用Python3.6与Django2.0.2(Django-rest-framework)以及前端vue开发的前后端分离的商城网站 项目支持支 ...
- Vue+Django REST framework打造生鲜电商项目
1-1 课程导学 2-1 Pycharm的安装和简单使用 2-2 MySQL和Navicat的安装和使用 2-3 Windows和Linux下安装Python2和Python3 2-4 虚拟环境的安装 ...
- Django序列化&django REST framework
第一章.Django序列化操作 1.django的view实现商品列表页(基于View类) # 通过json来序列化,但手写字典key代码量较大,容易出错:还有遇到时间,图片序列化会报错 from g ...
- Django REST framework+Vue 打造生鲜超市(三)
四.xadmin后台管理 4.1.xadmin添加富文本插件 (1)xadmin/plugins文件夹下新建文件ueditor.py 代码如下: # xadmin/plugins/ueditor.py ...
- Django REST framework+Vue 打造生鲜超市(五)
六.商品类别数据展示 6.1. 商品类别数据接口 (1)商品分类有两个接口: 一种是全部分类:一级二级三级 一种是某一类的分类以及商品详细信息: 开始写商品分类的接口 (2)序列化 给分类添加三级分类 ...
- Python3+PyCharm+Django+Django REST framework开发教程
一.说明 自己一是想跟上潮流二是习惯于直接干三是没有人可以请教,由于这三点经常搞得要死要活.之前只简单看过没写过Diango,没看过Django REST framework,今天一步到位直接上又撞上 ...
随机推荐
- Java知多少(53)使用Java创建自己的异常子类
尽管Java的内置异常处理大多数常见错误,你也许希望建立你自己的异常类型来处理你所应用的特殊情况.这是非常简单的:只要定义Exception的一个子类就可以了(Exception当然是Throwabl ...
- 【转】燃烧吧,TestMice!
...当我们几个人碰面的时候,就感觉应该做点测试业内的实事. 记得当时的17站出了一些QTP辅件,给了我一些灵感.2008年做了一整年的QTP企业级实施,从方案到最后的收尾支持,得到最大的教训就是,当 ...
- 说说自己对RESTful API的理解
REST不是英文上的rest单词,其英文缩写为presentational State Transfer ,直译为表现状态转移,咋看起来很学术,不懂,其实不用去死抠这个词的意思.REST是一种约束和架 ...
- snopy 数据库简介
snoRNA ,small nucleolar RNA, 核仁小分子RNA, 是一类在细胞核内的small non-coding RNA, 长度在60-300nt, 其主要功能是调控其他小RNA分子( ...
- Pycharm+Django搭建第一个Python Web程序
1.安装django 无论是Python2.x还是Python3.x版本,都可以使用pip来安装Django.在控制台使用如下命令:pip install django 如: 2.检查dgango是否 ...
- Ubuntu下安装和使用zookeeper和kafka
1.在清华镜像站下载kafka_2.10-0.10.0.0.tgz 和 zookeeper-3.4.10.tar.gz 分别解压到/usr/local目录下 2.进入zookeeper目录,在conf ...
- openwrt 域名ping不通 修改dns
问题 wget: bad address 'downloads.openwrt.org' wget: bad address 'downloads.openwrt.org' wget: bad add ...
- [TensorBoard] Train and Test accuracy simultaneous tracking
训练时的实时状态跟踪的重要性 不言而喻. [Tensorboard] Cookbook - Tensorboard 讲解调节更新频率 直接上代码展示: import numpy as np impo ...
- [Laravel] 15 - REST API: sidebar with unit test
前言 实现一个博客的侧边栏的链接,然后顺便对其进行单元测试的过程. Archives 一.视图中展示SQL结果 一条 sql 语句[查询] select year(created_at) year, ...
- [AWS] User management
IAM用户管理 Ref: AWS系列-创建 IAM 用户 Ref: AWS系列:深入了解IAM和访问控制 是什么? IAM enables you to control who can do what ...