配置python+mod_wsgi+apache 时 在浏览器中访问服务器时报错:Invalid HTTP_HOST header: 'XXXXX'. You may need to add u'XXXXX' to ALLOWED_HOSTS,在setting.py中添加ALLOWED_HOSTS['*"]无效的原因:是apache没有配置ServerName localhost:80 .配置完成后,解决了以上的问题 故障表现的现象是:使用localhost 访问apache是ok的,单无法使
常规的模板渲染 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
models之对于表的创建有以下几种: 一对一:ForeignKey("Author",unique=True), OneToOneField("Author") 一对多:ForeignKey(to="Publish",to_field="id",on_delete.CASCADE) 多对多:ManyToManyField(to="Author") 首先我们来创建几张表 from django.db im
下图是一个带被引入使用的包的结构,包名比较长,给书写from*import*带来很多麻烦 为了解决麻烦,在__init__.py编写了如下内容 from .httputil import HTTPUtil from .jsonutil import JSONUtil from .redisutil import RedisUtil from .time import TimeUtil from .randomutil import myrandom __all__=["HTTPUtil"
### Py去除列表中小于某个数的值 print('*'*10,'Py去除列表中小于某个数的值','*'*10) nums = [2,3,4,10,9,11,19,14] print('*'*10,'remove之后改变了索引顺序,所以结果不正确!','*'*10) for i in nums: if i<5: nums.remove(i) print(nums) print('*'*10,'pop之后改变了索引顺序,所以结果不正确!','*'*10) for i in nums: if i<