@Configuration public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("classpath:/st
常规的模板渲染 from django.db import models # Create your models here. class ArticalType(models.Model): caption = models.CharField(max_length=16) class Category(models.Model): caption = models.CharField(max_length=16) class Artical(models.Model): title = mo
在前面介绍spring cloud feign中我们已经使用过hystrix,只是没有介绍,spring cloud hystrix在spring cloud中起到保护微服务的作用,不会让发生的异常无边界的蔓延下去,很像我们电路中的保险设置,有超压或者线路有问题就即时的断开,保护用电设备不被损坏,这篇文章就来介绍spring cloud hystrix及其hystrix dashboard. (一) 版本说明 a) Spring boot 2.0.6.RELEASE b) Spring clou
''' 冒泡排序:比较相邻元素,顺序错误就交换顺序 ''' import random import cProfile def bubble_Sort(nums): for i in range(len(nums)-1): for j in range(i+1,len(nums)): if nums[i] > nums[j]: # max = nums[i] # nums[i] = nums[j] # nums[j] = max #python有更好的写法 nums[i],nums[j] = n
将n个任务交给n个进程去执行每一个进程在执行完毕之后会有一个返回值,这个返回值交给callback函数指定的那个函数去处理这样的话所有的进程哪一个执行的最后快,哪一个就可以先进性统计工作这样就能在最短的时间内得到我们想要的结果 import time import random from multiprocessing import Pool def get(i): # 使用i模拟网站地址 在子进程中执行 time.sleep(random.random()) # 模拟不同的网站返回数据的时间