Blueherb In solitude, where we are least alone
上一页 1 2 3 4 5 6 7 ··· 19 下一页
摘要: flask页面的跳转测试 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="styl 阅读全文
posted @ 2021-01-21 10:07 帅气的小土豆 阅读(20) 评论(0) 推荐(0) 编辑
摘要: flask的学习 简单的做了个flask服务的页面 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>新闻分类</title> </head> <body> <form action="/search-post/" method= 阅读全文
posted @ 2021-01-20 10:05 帅气的小土豆 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 问题:post 请求返回 403 1. 解决: 导入模块: from django.views.decorators.csrf import csrf_exempt 在函数前面添加修饰器: @csrf_exempt 2. 原因: 当采用客户端象 django 的服务器提交 post 请求时,会得到4 阅读全文
posted @ 2021-01-19 09:55 帅气的小土豆 阅读(16) 评论(0) 推荐(0) 编辑
摘要: from django.shortcuts import render_to_response 会报以下错误 ImportError: cannot import name 'render_to_response' from 'django.shortcuts' 原因是在Django 2已经弃用了r 阅读全文
posted @ 2021-01-18 09:53 帅气的小土豆 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 执行search请求 响应,出现错误 ,中文解析不了: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128) 解决办法,添加如下代码到 search.py import sys reload(sys 阅读全文
posted @ 2021-01-17 09:51 帅气的小土豆 阅读(19) 评论(0) 推荐(0) 编辑
摘要: POST 方法 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <form action="/search-post/" method="post"> {% csrf_t 阅读全文
posted @ 2021-01-16 09:50 帅气的小土豆 阅读(28) 评论(0) 推荐(0) 编辑
摘要: Django 表单 HTML表单是网站交互性的经典方式。 本章将介绍如何用Django对用户提交的表单数据进行处理。 HTTP 请求 HTTP协议以"请求-回复"的方式工作。客户发送请求时,可以在请求中附加数据。服务器通过解析请求,就可以获得客户传来的数据,并根据URL来提供特定的服务。 GET 方 阅读全文
posted @ 2021-01-15 09:48 帅气的小土豆 阅读(30) 评论(0) 推荐(0) 编辑
摘要: Python下有许多款不同的 Web 框架。Django和flask是我所接触到的 启动django后,不能访问,报400错误。 原因:没有开启允许访问 处理:编辑HelloWorld目录下setting.py ,把其中的 ALLOWED_HOSTS=[]改成ALLOWED_HOSTS=['*'] 阅读全文
posted @ 2021-01-14 09:45 帅气的小土豆 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 使用 from sound.effects import * Python 会进入文件系统,找到这个包里面所有的子模块,然后一个一个的把它们都导入进来。 但这个方法在 Windows 平台上工作的就不是非常好,因为 Windows 是一个不区分大小写的系统。 在 Windows 平台平台上,我们无法 阅读全文
posted @ 2021-01-13 09:40 帅气的小土豆 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 列表推导式(又称列表解析式)提供了一种简明扼要的方法来创建列表。 它的结构是在一个中括号里包含一个表达式,然后是一个for语句,然后是 0 个或多个 for 或者 if 语句。那个表达式可以是任意的,意思是你可以在列表中放入任意类型的对象。返回结果将是一个新的列表,在这个以 if 和 for 语句为 阅读全文
posted @ 2021-01-12 09:37 帅气的小土豆 阅读(18) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 19 下一页