Python pip 使用国内镜像源
1、执行以下两个命令,设置全局使用国内源(中科大)
123pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simplepip config set global.trusted-host https://mirrors.ustc.edu.cn/pypi/web/simple
2、输出(查看)现有的pip源:
1pip config list
使用 Flask 编写 RESTful API
HTTP 的常用请求方法如下:
HTTP 方法
行为
示例
GET
获取资源的信息
http://example.com/api/orders
GET
获取某个特定资源的信息
http://example.com/api/orders/123
POST
创建新资源
http://example.com/api/orders
PUT
更新资源
http://example.com/api/orders/123
PATCH
对 PUT 方法的补充,用来对已知资源进行局部更新
http://example.com/api/orders/123
DELETE
删除资源
http://example.com/api/orders/123
REST 设计不需要特定的数据格式。在请求中数据可以以 JSON 形式, 或者有时候作为 url 中查询参数项。
RESTful API规划
HTTP 方法
URL
动作
GET
http://127.0.0.1:5000/api/v1/books
查询图书列表,支持分页查询,分页的参数为JSON格式数据: ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(十) - 话题详情页及评论
项目演示地址:https://hujiyi.github.io/acme-world-web/
论坛话题详情页中,首先要显示的是话题有关的内容,比如标题、作者、时间、内容等各种信息
除此以外,还要提供一个用于发表评论的表单,以及显示当前话题已有的评论内容。
评论需要使用一个单独的表(Class) 来进行存放,同时,还要记录是对哪个话题进行的评论。
查询指定 id 的话题,和增加查看次数进入详情页后,要先把指定 id 的话题显示出来,同时这个话题的查看次数也在增加,相应的功能可以添加到 TopicService 中。
打开文件src/api/service/topic_service.js, 修改其内容如以下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import LC from 'leancloud-storage'; // 导入 leancloud 数据存储模块impo ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(九) - 首页显示话题列表
项目演示地址:https://hujiyi.github.io/acme-world-web/
网站前台的规划与路由要显示论坛的话题列表,以及显示话题的详细内容、添加及显示用户的评论,需要添加相应的视图
添加前台视图文件在 src/views/home 文件夹添加一个名为 pages 的文件夹,然后在该文件夹中添加用于显示话题列表的视图文件TopicList.vue 以及 显示话题详情的视图文件 Detail.vue。
src/views/ 文件夹的最终组成结构如以下所示:
1234567891011121314151617181920212223.|-- account| |-- pages| | |-- Login.vue| | |-- PasswordReset.vue| | `-- SignUp.vue| `-- Index.vue|-- dashboard| |-- forum| | |-- CommentManager.vue| | `-- TopicManager.vue| |-- layout| | |- ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(八) - 论坛话题管理的实现
项目演示地址:https://hujiyi.github.io/acme-world-web/
论坛话题的数据存储服务类在 src/api/service/ 文件夹下新建 topic_service.js,
打开文件 src/api/service/topic_service.js, 编辑其代码如下:
12345678910111213141516171819import BaseService from './base_service'; // 导入访问 leancloud 数据存储的基类const TABLE_NAME = 'Topic'; // leancloud 中存储数据的表名(Class)/** * 对leancloud应用中 名为 "Topic" 的 Class 进行数据操作的类 */class TopicService extends BaseService { constructor(table_name) { // 调用父类的构造函数 sup ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(七) - LeanCloud 数据存储和路由守卫的使用
项目演示地址:https://hujiyi.github.io/acme-world-web/
LeanCloud 数据存储LeanCloud 数据存储 的两种 ClassLeanCloud 数据存储的 Class 有两种,一种是创建应用时就自带的,这一种Class的名字以 下划线开头,可以在这些 Class 中添加字段, 但一般不要删除;另一种是用户自己创建的 Class,可以由用户自定义需要的字段, 同时,自定义的每个 Class 还会有四个系统自带的字段:objectId, ACL, createdAt, updatedAt, 说明如下:
objectId: 主键字段,实际使用时,可以通过 类名.id 获取值;
ACL: 访问控制列表, 用于权限管理开发,免费用户不可用;
createdAt: 记录创建时间,添加记录时自动产生,不能更改;
updatedAt: 记录更新时间,记录有更新时自动修改,不能由用户进行修改;
在数据存储中创建 Class在数据存储中创建 Class 有两个方法:
方法一:在 LeanCloud 数据存储 的管理界面 手工 添加 Class, ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(六) - 实现用户注册、登录、找回密码
项目演示地址:https://hujiyi.github.io/acme-world-web/
Leancloud 数据存储LeanCloud(原 AVOS Cloud) 是针对移动应用的一站式云端服务,专注于为应用开发者提供工具和平台。提供包括LeanStorage 数据存储、LeanMessage 通信服务、LeanAnalytics 统计分析、LeanModules 拓展模块等四大类型的后端云服务。当前项目使用了LeanStorage 数据存储来实现论坛数据的保存。
Leancloud SDK 的初始化配置信息LeanCloud 国内默认的是华北节点,但是去年华北节点的文件服务器因为某些原因,出现了域名服务方面的问题。导致文件可以上传,但是没办法访问,所以这里建设使用 华东节点。
登录 Leancloud华东节点 (没有账号的请先注册),然后创建应用,应用名称自己取,操作类似下图:
应用创建成功后,点击该应用最左边的 数据存储 图标,进入应用管理界面,如下图:
在右侧菜单选择:设置 -> 应用凭证, 即可看到当前应用的 AppID, AppKey, REST AP ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(五) - 后台管理界面
项目演示地址:https://hujiyi.github.io/acme-world-web/
文件与路由规划相对于其他两大部分来说,后台管理界面的组成更复杂,包含的组件、视图也更多。 为了更方便进行管理, 将相应的文件分别放到不同的文件夹下。就当前项目来说,主要实现一个论坛的后台管理功能,所以在 dashboard 文件夹中分别创建三个文件夹用于存放不同的文件:
layout 文件夹: 用于存放后台管理界面(仪表盘)的组成组件;
forum 文件夹:用于存放和论坛管理有关的视图;
pages 文件夹: 用于存放仪表盘其他部分的视图;
如果有更多的内容,也可以建相应的文件夹进行分类存放
创建文件夹和文件根据以上规划,在 dashboard 文件夹 分别 创建名为:layout 、forum 、pages 的文件夹。
在 src/views/dashboard/forum/ 文件夹下添加以下两个文件:
TopicManager.vue: 论坛话题管理视图;
CommentManager.vue: 话题评论管理视图。
在 src/views/dashboard/la ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(四) - 登录与注册界面设计
项目演示地址:https://hujiyi.github.io/acme-world-web/
账号模块的路由规划在当前项目中, 账号模块实现三个部分的功能:用户登录、用户注册、通过邮箱找回密码, 这三个部分都放在 src/views/account/ 文件夹下。
创建文件夹和文件在 src/views/account/ 下创建名为 pages 的文件夹,然后在该文件下添加三个 vue文件:Login.vue, PasswordReset.vue, SignUp.vue。
创建完成后的 views 文件夹下的项目结构如下图:
12345678910|-- account| |-- pages| | |-- Login.vue| | |-- PasswordReset.vue| | `-- SignUp.vue| `-- Index.vue|-- dashboard| `-- Index.vue`-- home `-- Index.vue
编辑src/views/account/pages/Login.vue, 内容如以下代码:
123456 ...
使用 Element UI 和 Leancloud 的 Vue.js 项目开发(三) - 首页初步设计
项目演示地址:https://hujiyi.github.io/acme-world-web/
首页初步设计对于一个论坛网站来说,用户登录、进入后台管理界面后发表话题, 首页才有内容可以显示。但是为了不让首页太难看、同时提供到过其他视图的跳转,需要先对首页进行一些简单的设计。
修改首页的 template打开 src/views/home/Index.vue , 编辑其内容如以下代码:
123456789101112131415161718192021222324<template> <el-container> <el-header> <div class="logo">Acme World APP</div> <router-link to="/dashboard"> <el-button type="text">后台管理</el-butt ...