随笔分类 - python
摘要:https://docs.djangoproject.com/zh-hans/2.0/topics/auth/default/#authentication-in-web-requests django认证模型系统是django自带,默认配置文件在settings.py文件当中。这个项目在INSTA
阅读全文
摘要:settings.pyDATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'domain', 'USER': 'root', 'PASSWORD': 'fZrJLmM8)pU', 'HOST': '192.
阅读全文
摘要:博客 - kindeditor - beautifulsoup4对标签进行过滤 - 单例模式 - 事务操作 - from django.db import transaction - 利用数据库函数实现数据筛选 如:stftime
阅读全文
摘要:原理: 1.创建script标签 2.src远程地址 3.返回的数据必须为js格式 1.因为浏览器处于安全原因不允许跨域请求,但是允许跨域倒入js文件,所以需要创建script标签 2.src远程地址,这里的地址代表着接口地址,因为接口提供的数据为js文件格式,里面有对应的function和数据。
阅读全文
摘要:常规的模板渲染 from django.db import models # Create your models here. class ArticalType(models.Model): caption = models.CharField(max_length=16) class Categ
阅读全文
摘要:Django2.0之后,如果url.py中需要添加正则,需要添加
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .pg-header{ background-color: red; height: 48px; /*添加posit
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> .hide{ display: none; } .modal{ position: fixed; top: 50%;
阅读全文
摘要:class UserType(models.Model): caption = models.CharField(max_length=32) class User(models.Model): name = models.CharField(max_length=32) age = models.
阅读全文
摘要:1.创建验证码模块 #!/usr/bin/env python # -*- coding:utf-8 -*- import random from PIL import Image, ImageDraw, ImageFont, ImageFilter _letter_cases = "abcdefg
阅读全文
摘要:def upload(request): return render(request, 'upload.html') def upload_file(request): username = request.POST.get('username') fafafa = request.FILES.ge
阅读全文
摘要:Django之Form组件 Django的Form主要具有一下几大功能: 生成HTML标签 验证用户数据(显示错误信息) HTML Form提交保留上次提交数据 初始化页面显示内容 Django的Form主要具有一下几大功能: 生成HTML标签 验证用户数据(显示错误信息) HTML Form提交保
阅读全文
摘要:一、session原理及其使用 一、Session原理 Cookie是保存在用户浏览器端的键值对 Session是保存在服务器端的键值对 二、cookie与session对比 首先来说一下什么是cookie:cookie是Web服务器保存在客户端的一系列文本信息; cookie的作用大致有三点:对特
阅读全文
摘要:js $查找id、class,find查找"name"、数据类型,如:input、select、check
阅读全文
摘要:django程序进阶 一、URL路由转发 # django的生命周期 1.django获取表单数据 2.上传文件 from django.shortcuts import render # Create your views here. from django.shortcuts import re
阅读全文
摘要:一 、js正则 test - 判断是否符合规定的正则 exec - 获取匹配的数据 test rep = /\d+/; /\d+/ rep.te undefined rep.test("dgdf343dgffddsf332") true rep.test("dsfssgd") false rep =
阅读全文
摘要:创建表 create table student( `id` int not null primary key auto_increment, `name` char(32)); 插入数据insert into student(name) values ('pan');insert into stu
阅读全文

浙公网安备 33010602011771号