pwd

WTForms

淺唱寂寞╮ 提交于 2019-11-30 21:01:34
文章出处 https://www.cnblogs.com/wupeiqi/articles/8202357.html 简介 W TForms是一个支持多个web框架的form组件,主要用于对用户请求数据进行验证。 安装: ? 1 pip3 install wtforms 用户登录注册示例 1. 用户登录 当 用户登录时候,需要对用户提交的用户名和密码进行多种格式校验。如: 用户不能为空;用户长度必须大于6; 密码不能为空;密码长度必须大于12;密码必须包含 字母、数字、特殊字符等(自定义正则); #!/usr/bin/env python # -*- coding:utf-8 -*- from flask import Flask, render_template, request, redirect from wtforms import Form from wtforms.fields import core from wtforms.fields import html5 from wtforms.fields import simple from wtforms import validators from wtforms import widgets app = Flask(__name__, template_folder='templates') app.debug

MySQL数据库修改名字

吃可爱长大的小学妹 提交于 2019-11-30 19:23:13
[root@mysql-master-15-137 ~]# cat rename_database.sh #!/bin/bash # 本脚本是针对于MySQL数据库类型为Innodb修改数据名的。 # 假如是myisam的存储引擎,直接在数据目录下mv就行。 # 用法:假设将OLD_DATABASE数据库名改为NEW_DATABASE OLD_DATABASE="loanflow" NEW_DATABASE="loanflow_test" PWD="123456" mysql -uroot -p$PWD -e "create database if not exists $NEW_DATABASE" list_table=$(mysql -uroot -p$PWD -Nse "select table_name from information_schema.TABLES where TABLE_SCHEMA='$OLD_DATABASE'") for table in $list_table do mysql -uroot -p$PWD -e "rename table $OLD_DATABASE.$table to $NEW_DATABASE.$table" done 来源: https://www.cnblogs.com/sandshell/p/11637268.html

常用命令(1)

扶醉桌前 提交于 2019-11-30 19:22:47
pwd:   printing working directory,显示工作目录 cd:   change directory,切换目录   使用格式:~]# cd [/PATH/TO/SOMEDIR]   常用方式:     ~]# cd:切换回家目录     ~]# cd ~:切换回自己的家目录(在bash中,~表示家目录)     ~]# cd ~USERNAME:切换至指定用户的家目录     ~]# cd -:在上一次所在目录与当前目录之间来回切换     相关的环境变量:       $PWD:表示当前工作目录,~]# pwd = ~]# echo $PWD       $OLDPWD:上一次的工作目录,~]# cd- = cd $OLDPWD ls:   list,列出指定目录下的内容   使用格式:ls [OPTIONS]... [FILE]...   常用选项:     -a,显示所有文件,包括隐藏文件     -A,显示除 . 和 .. 之外的所有文件,包括隐藏文件     -l,长格式列表,即显示文件的详细属性信息     -h,对文件大小进行单位换算,结果可能不是精确值     -d,查看目录自身而非其内部的文件列表,通常与 -l 连用     -r,逆序显示     -R,递归显示   针对于 -l 选项对文件的详细信息进行简要介绍:(自左而右)   例:

python面向对象练习--选课系统

本秂侑毒 提交于 2019-11-30 18:50:14
这几天学完面向对象,然后找了一个练习做(题目如下):因为刚刚接触编程,可能有很多方面考虑得不周到 目录如下: import os import sys BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASEDIR) from core.admin_view import admin_main from lib.public_func import instanc from core.student_view import student_main from core.teacher_view import teacher_main def main(): msg = ''' --------------------选课系统--------------------- 1 管理员 2 讲师 3 学生 ''' msg_main = { '1' : admin_main, '2' : teacher_main, '3' : student_main } instanc(msg,msg_main) if __name__ == '__main__': main() bin.py import os BASEDIR = os.path.dirname(os.path

仿优酷项目—orm

两盒软妹~` 提交于 2019-11-30 16:51:06
仿优酷项目 一、ORM介绍 对象关系映射,把数据库中的表数据(表名、表记录、字段)全部映射到python中。 ​ mysql: python: ​ 表名 ————>类名 ​ 记录 ————>对象 ​ 字段 ————>对象.属性 第一步: 写字段类型的类 --字段名 ​ --字段类型(长度) ​ --varchar(256) ​ --int ​ --是否为主键 ​ --默认值 ​ 仿优酷中使用的字段类型: ​ —int ​ —string 第二步 :写表类 User: #用户表 ​ user_name ​ pwd ​ Movie: #电影表 ​ movie_name ​ movie_size ​ Notice: #公告表 ​ title ​ content 接下来我们解决三个问题: 问题1: 假设100张表就需要写100个__init__。 解决: 继承一个Models父类 问题2: 每张表的字段名与字段数量不同,导致无法直接继承Models父类 解决: dict是对象,继承dict,触发字典内部的__init__(可接受任意数量以及任意类型属性) 问题3: 字典的取/存值方式有限,希望改为 对象.属性取值, 对象.属性=值 存值的方式。 解决: __getattr__: 取值方式 __setattr__: 存值方式 第三步: 表的约束 问题: 让所有的表类都遵循以下约束 - 表名

sqoop在创建job时如何免密输入

情到浓时终转凉″ 提交于 2019-11-30 15:59:38
sqoop在创建job时, 规定密码文件必须存放在HDFS上,并且权限必须设置成为是400 。 echo -n "hadoop" > itcastmysql.pwdhadoop fs -mkdir -p /input/sqoop/pwd/hadoop fs -put itcastmysql.pwd /input/sqoop/pwd/hadoop fs -chmod 400 /input/sqoop/pwd/itcastmysql.pwd //将密码设置成为仅读权限 载sqoop/conf幕布下的sqoop-site.xml中添加如下配置: <property> <name>sqoop.metastore.client.record.password</name> <value>true</value> <description>If true, allow saved passwords in the metastore. </description></property> 创建sqoop job 在创建job时,使用--password-file参数 bin/sqoop job --create itcastjob1 -- import --connect jdbc:mysql://node03:3306/userdb \--username root \--password

“ImportError: No module named pwd” but it exists

◇◆丶佛笑我妖孽 提交于 2019-11-30 13:28:30
I'm trying to test gae-boilerplate locally, but when I try to create a new account the following error appears. The strange thing is that if I open python interpreter and type "import pwd" it works. Internal Server Error The server has either erred or is incapable of performing the requested operation. Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__ rv = self.handle_exception(request, response, e) File "/Applications

Extract the last directory of a pwd output

痞子三分冷 提交于 2019-11-30 12:42:01
问题 How do I extract the last directory of a pwd output? I don't want to use any knowledge of how many levels there are in the directory structure. If I wanted to use that, I could do something like: > pwd /home/kiki/dev/my_project > pwd | cut -d'/' -f5 my_project But I want to use a command that works regardless of where I am in the directory structure. I assume there is a simple command to do this using awk or sed. 回答1: Are you looking for basename or dirname? Something like basename "`pwd`"

QT的一些配置

心不动则不痛 提交于 2019-11-30 11:57:36
# 程序图标 RC_ICONS = logo.ico # 版本号 VERSION = 1.0.1 # 语言 # 0x0004 表示 简体中文 # 详见 https://msdn.microsoft.com/en-us/library/dd318693%28vs.85%29.aspx RC_LANG = 0x0004 # 公司名 QMAKE_TARGET_COMPANY = 四川XX科技 # 产品名称 QMAKE_TARGET_PRODUCT = XX辅助工具 # 详细描述 QMAKE_TARGET_DESCRIPTION = XX配置工具 # 版权 QMAKE_TARGET_COPYRIGHT = Copyright(C) 2019 ##################配置库的相对路径############################# INCLUDEPATH += $$PWD/ffmpeg/include DEPENDPATH += $$PWD/ffmpeg/lib ##################mingw配置方式############################# LIBS += $$PWD/ffmpeg/lib/libavformat.dll.a LIBS += $$PWD/ffmpeg/lib/libavutil.dll.a LIBS += $$PWD

Django Form表单组件

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 11:02:02
Django Form表单组件 Form介绍 我们之前在HTML页面中利用form表单向后端提交数据时,都会写一些获取用户输入的标签并且用form标签把它们包起来。 与此同时我们在好多场景下都需要对用户的输入做校验,比如校验用户是否输入,输入的长度和格式等正不正确。如果用户输入的内容有错误就需要在页面上相应的位置显示对应的错误信息.。 Django form组件就实现了上面所述的功能。 总结一下,其实form组件的主要功能如下: 生成页面可用的HTML标签 对用户提交的数据进行校验 保留上次输入内容 普通方式手写注册功能 views.py # 注册 def register(request): error_msg = "" if request.method == "POST": username = request.POST.get("name") pwd = request.POST.get("pwd") # 对注册信息做校验 if len(username) < 6: # 用户长度小于6位 error_msg = "用户名长度不能小于6位" else: # 将用户名和密码存到数据库 return HttpResponse("注册成功") return render(request, "register.html", {"error_msg": error_msg})