diff --git "a/Day01-15/01.\345\210\235\350\257\206Python.md" "b/Day01-15/01.\345\210\235\350\257\206Python.md" index 05acd8545..6d02bf5f4 100644 --- "a/Day01-15/01.\345\210\235\350\257\206Python.md" +++ "b/Day01-15/01.\345\210\235\350\257\206Python.md" @@ -57,15 +57,15 @@ yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlit 2. 下载Python源代码并解压缩到指定目录。 ```Shell -wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz -xz -d Python-3.7.3.tar.xz -tar -xvf Python-3.7.3.tar +wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tar.xz +xz -d Python-3.7.6.tar.xz +tar -xvf Python-3.7.6.tar ``` 3. 切换至Python源代码目录并执行下面的命令进行配置和安装。 ```Shell -cd Python-3.7.3 +cd Python-3.7.6 ./configure --prefix=/usr/local/python37 --enable-optimizations make && make install ``` diff --git "a/Day36-40/36-38.\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223MySQL.md" "b/Day36-40/36-38.\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223MySQL.md" index ce1abf296..cab25586f 100644 --- "a/Day36-40/36-38.\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223MySQL.md" +++ "b/Day36-40/36-38.\345\205\263\347\263\273\345\236\213\346\225\260\346\215\256\345\272\223MySQL.md" @@ -174,7 +174,7 @@ MySQL在过去由于性能高、成本低、可靠性好,已经成为最流行 alter user 'root'@'localhost' identified by '123456'; ``` - > 说明:MySQL较新的版本默认不允许使用弱口令作为用户口令,所以我们通过上面的前两条命令修改了验证用户口令的策略和口令的长度。事实上我们不应该使用弱口令,因为存在用户口令被暴力破解的风险。近年来,攻击数据库窃取数据和劫持数据库勒索比特币的事件屡见不鲜,要避免这些潜在的风险,最为重要的一点是不要让数据库服务器暴露在公网上(最好的做法是将数据库置于内网,至少要做到不向公网开放数据库服务器的访问端口),另外要保管好`root`账号的口令,应用系统需要访问数据库时,通常不使用`root`账号进行访问,而是创建其他拥有适当权限的账号来访问。 + > **说明**:MySQL较新的版本默认不允许使用弱口令作为用户口令,所以我们通过上面的前两条命令修改了验证用户口令的策略和口令的长度。事实上我们不应该使用弱口令,因为存在用户口令被暴力破解的风险。近年来,攻击数据库窃取数据和劫持数据库勒索比特币的事件屡见不鲜,要避免这些潜在的风险,最为重要的一点是不要让数据库服务器暴露在公网上(最好的做法是将数据库置于内网,至少要做到不向公网开放数据库服务器的访问端口),另外要保管好`root`账号的口令,应用系统需要访问数据库时,通常不使用`root`账号进行访问,而是创建其他拥有适当权限的账号来访问。 再次使用客户端工具连接MySQL服务器时,就可以使用新设置的口令了。在实际开发中,为了方便用户操作,可以选择图形化的客户端工具来连接MySQL服务器,包括: @@ -1199,7 +1199,7 @@ insert into tb_emp values # 1. 创建数据库连接对象 con = pymysql.connect(host='localhost', port=3306, database='hrs', charset='utf8', - user='root', password='123456') + user='yourname', password='yourpass') try: # 2. 通过连接对象获取游标 with con.cursor() as cursor: @@ -1231,7 +1231,7 @@ insert into tb_emp values no = int(input('编号: ')) con = pymysql.connect(host='localhost', port=3306, database='hrs', charset='utf8', - user='root', password='123456', + user='yourname', password='yourpass', autocommit=True) try: with con.cursor() as cursor: @@ -1263,7 +1263,7 @@ insert into tb_emp values loc = input('所在地: ') con = pymysql.connect(host='localhost', port=3306, database='hrs', charset='utf8', - user='root', password='123456', + user='yourname', password='yourpass', autocommit=True) try: with con.cursor() as cursor: @@ -1291,7 +1291,7 @@ insert into tb_emp values def main(): con = pymysql.connect(host='localhost', port=3306, database='hrs', charset='utf8', - user='root', password='123456') + user='yourname', password='yourpass') try: with con.cursor(cursor=DictCursor) as cursor: cursor.execute('select dno as no, dname as name, dloc as loc from tb_dept') @@ -1334,7 +1334,7 @@ insert into tb_emp values size = int(input('大小: ')) con = pymysql.connect(host='localhost', port=3306, database='hrs', charset='utf8', - user='root', password='123456') + user='yourname', password='yourpass') try: with con.cursor() as cursor: cursor.execute( diff --git "a/Day36-40/39-40.NoSQL\345\205\245\351\227\250.md" "b/Day36-40/39-40.NoSQL\345\205\245\351\227\250.md" index c5fbe4cc7..35ab2cab6 100644 --- "a/Day36-40/39-40.NoSQL\345\205\245\351\227\250.md" +++ "b/Day36-40/39-40.NoSQL\345\205\245\351\227\250.md" @@ -107,7 +107,7 @@ redis-server 方式一:通过参数指定认证口令和AOF持久化方式。 ```Shell -redis-server --requirepass 1qaz2wsx --appendonly yes +redis-server --requirepass yourpass --appendonly yes ``` 方式二:通过指定的配置文件来修改Redis的配置。 @@ -119,7 +119,7 @@ redis-server /root/redis-5.0.4/redis.conf 下面我们使用第一种方式来启动Redis并将其置于后台运行,将Redis产生的输出重定向到名为redis.log的文件中。 ```Shell -redis-server --requirepass 1qaz2wsx > redis.log & +redis-server --requirepass yourpass > redis.log & ``` 可以通过ps或者netstat来检查Redis服务器是否启动成功。 @@ -133,7 +133,7 @@ netstat -nap | grep redis-server ```Shell redis-cli -127.0.0.1:6379> auth 1qaz2wsx +127.0.0.1:6379> auth yourpass OK 127.0.0.1:6379> ping PONG @@ -274,7 +274,7 @@ python3 ```Python >>> import redis ->>> client = redis.Redis(host='1.2.3.4', port=6379, password='1qaz2wsx') +>>> client = redis.Redis(host='1.2.3.4', port=6379, password='yourpass') >>> client.set('username', 'admin') True >>> client.hset('student', 'name', 'hao') diff --git a/Day36-40/code/contact/main.py b/Day36-40/code/contact/main.py index 2e95a3312..70ebb3692 100644 --- a/Day36-40/code/contact/main.py +++ b/Day36-40/code/contact/main.py @@ -171,8 +171,8 @@ def find_contacters(con): def main(): - con = pymysql.connect(host='120.77.222.217', port=3306, - user='root', passwd='123456', + con = pymysql.connect(host='1.2.3.4', port=3306, + user='yourname', passwd='yourpass', db='address', charset='utf8', autocommit=True, cursorclass=pymysql.cursors.DictCursor) diff --git "a/Day41-55/42.\346\267\261\345\205\245\346\250\241\345\236\213.md" "b/Day41-55/42.\346\267\261\345\205\245\346\250\241\345\236\213.md" index 3ba9035ab..8b0701255 100644 --- "a/Day41-55/42.\346\267\261\345\205\245\346\250\241\345\236\213.md" +++ "b/Day41-55/42.\346\267\261\345\205\245\346\250\241\345\236\213.md" @@ -29,10 +29,10 @@ 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'oa', - 'HOST': '127.0.0.1', + 'HOST': '1.2.3.4', 'PORT': 3306, - 'USER': 'root', - 'PASSWORD': '123456', + 'USER': 'yourname', + 'PASSWORD': 'yourpass', } } diff --git a/Day41-55/code/shop/shop/settings.py b/Day41-55/code/shop/shop/settings.py index f90e37a5c..deffddafd 100644 --- a/Day41-55/code/shop/shop/settings.py +++ b/Day41-55/code/shop/shop/settings.py @@ -81,8 +81,8 @@ 'NAME': 'shop', 'HOST': 'localhost', 'PORT': 3306, - 'USER': 'root', - 'PASSWORD': '123456', + 'USER': 'yourname', + 'PASSWORD': 'yourpass', } } diff --git a/Day41-55/code/shop_origin/shop/settings.py b/Day41-55/code/shop_origin/shop/settings.py index 337b09992..53db10514 100644 --- a/Day41-55/code/shop_origin/shop/settings.py +++ b/Day41-55/code/shop_origin/shop/settings.py @@ -81,8 +81,8 @@ 'NAME': 'Shop', 'HOST': 'localhost', 'PORT': 3306, - 'USER': 'root', - 'PASSWORD': '123456', + 'USER': 'yourname', + 'PASSWORD': 'yourpass', } } diff --git a/Day61-65/code/hello-tornado/example04.py b/Day61-65/code/hello-tornado/example04.py index 7b9204c0f..405b00c3b 100644 --- a/Day61-65/code/hello-tornado/example04.py +++ b/Day61-65/code/hello-tornado/example04.py @@ -14,8 +14,10 @@ define('port', default=8888, type=int) +# 请求天行数据提供的API数据接口 REQ_URL = 'http://api.tianapi.com/guonei/' -API_KEY = '772a81a51ae5c780251b1f98ea431b84' +# 在天行数据网站注册后可以获得API_KEY +API_KEY = 'your_personal_api_key' class MainHandler(tornado.web.RequestHandler): diff --git a/Day61-65/code/hello-tornado/example05.py b/Day61-65/code/hello-tornado/example05.py index e2f6117e7..5ae1ced69 100644 --- a/Day61-65/code/hello-tornado/example05.py +++ b/Day61-65/code/hello-tornado/example05.py @@ -14,8 +14,10 @@ define('port', default=8888, type=int) +# 请求天行数据提供的API数据接口 REQ_URL = 'http://api.tianapi.com/guonei/' -API_KEY = '772a81a51ae5c780251b1f98ea431b84' +# 在天行数据网站注册后可以获得API_KEY +API_KEY = 'your_personal_api_key' class MainHandler(tornado.web.RequestHandler): diff --git a/Day61-65/code/hello-tornado/example06.py b/Day61-65/code/hello-tornado/example06.py index 7143351f8..bcb02bfc7 100644 --- a/Day61-65/code/hello-tornado/example06.py +++ b/Day61-65/code/hello-tornado/example06.py @@ -15,13 +15,13 @@ async def connect_mysql(): return await aiomysql.connect( - host='120.77.222.217', + host='1.2.3.4', port=3306, db='hrs', charset='utf8', use_unicode=True, - user='root', - password='123456', + user='yourname', + password='yourpass', ) diff --git a/Day61-65/code/hello-tornado/example07.py b/Day61-65/code/hello-tornado/example07.py index e0d454c52..df3898098 100644 --- a/Day61-65/code/hello-tornado/example07.py +++ b/Day61-65/code/hello-tornado/example07.py @@ -21,13 +21,13 @@ def get_mysql_connection(): return connect( - host='120.77.222.217', + host='1.2.3.4', port=3306, db='hrs', charset='utf8', use_unicode=True, - user='root', - password='123456', + user='yourname', + password='yourpass', ) diff --git a/Day61-65/code/project_of_tornado/backend_server.py b/Day61-65/code/project_of_tornado/backend_server.py index 610d301bd..973242ff8 100644 --- a/Day61-65/code/project_of_tornado/backend_server.py +++ b/Day61-65/code/project_of_tornado/backend_server.py @@ -19,13 +19,13 @@ async def connect_mysql(): return await aiomysql.connect( - host='120.77.222.217', + host='1.2.3.4', port=3306, db='hrs', charset='utf8', use_unicode=True, - user='root', - password='123456', + user='yourname', + password='yourpass', ) diff --git "a/Day91-100/95.\344\275\277\347\224\250Django\345\274\200\345\217\221\345\225\206\344\270\232\351\241\271\347\233\256.md" "b/Day91-100/95.\344\275\277\347\224\250Django\345\274\200\345\217\221\345\225\206\344\270\232\351\241\271\347\233\256.md" index 9e1a8afec..391d44d85 100644 --- "a/Day91-100/95.\344\275\277\347\224\250Django\345\274\200\345\217\221\345\225\206\344\270\232\351\241\271\347\233\256.md" +++ "b/Day91-100/95.\344\275\277\347\224\250Django\345\274\200\345\217\221\345\225\206\344\270\232\351\241\271\347\233\256.md" @@ -853,7 +853,7 @@ CACHES = { 'CONNECTION_POOL_KWARGS': { 'max_connections': 1000, }, - 'PASSWORD': '1qaz2wsx', + 'PASSWORD': 'yourpass', } }, # 页面缓存 @@ -868,7 +868,7 @@ CACHES = { 'CONNECTION_POOL_KWARGS': { 'max_connections': 500, }, - 'PASSWORD': '1qaz2wsx', + 'PASSWORD': 'yourpass', } }, # 会话缓存 @@ -884,7 +884,7 @@ CACHES = { 'CONNECTION_POOL_KWARGS': { 'max_connections': 2000, }, - 'PASSWORD': '1qaz2wsx', + 'PASSWORD': 'yourpass', } }, # 接口数据缓存 @@ -899,7 +899,7 @@ CACHES = { 'CONNECTION_POOL_KWARGS': { 'max_connections': 500, }, - 'PASSWORD': '1qaz2wsx', + 'PASSWORD': 'yourpass', } }, } @@ -1781,7 +1781,7 @@ CORS_ORIGIN_ALLOW_ALL = True >>> signer.unsign(value) 'hello, world!' >>> ->>> signer = Signer(salt='1qaz2wsx') +>>> signer = Signer(salt='yoursalt') >>> signer.sign('hello, world!') 'hello, world!:9vEvG6EA05hjMDB5MtUr33nRA_M' >>>