python3 web.py
来源:互联网 发布:淘宝地址怎么改邮编 编辑:程序博客网 时间:2024/06/05 14:20
https://stackoverflow.com/questions/41304192/python-alternative-for-web-py-on-python3
Python3 安装 web.py 失败:
import utils, db, net, wsgi, http, webapi, httpserver, debugerror ImportError: No module named 'utils'
按一下办法解决:
pip3 install web.py==0.40.dev0
Python3 安装MySQL
http://www.runoob.com/python3/python3-mysql.html
pip3 install PyMySQL
改错误:
ERROR 1698 (28000): Access denied for user ‘root’@’localhost’
首先查看mysql的conf文件查看用户名和密码:
/etc/mysql
展示如下:
conf.d debian.cnf debian-start my.cnf my.cnf.fallback mysql.cnf mysql.conf.d
执行sudo cat debian.cnf
展示如下:
# Automatically generated for Debian scripts. DO NOT TOUCH![client]host = localhostuser = debian-sys-maintpassword = XG6IscrXa4gslb4nsocket = /var/run/mysqld/mysqld.sock[mysql_upgrade]host = localhostuser = debian-sys-maintpassword = XG6IscrXa4gslb4nsocket = /var/run/mysqld/mysqld.soc
其中user和password即为你的mysql的用户名和密码。再次链接数据库 即可成功!
ERROR (1366, "Incorrect string value: '\\xE6\\x8F\\x8F\\xE8\\xBF\\xB0' for column 'projectDescribe' at row 2")ERROR (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1.1.0.0\\xe6\\x8f\\x8f\\xe8\\xbf\\xb0'', isUse = 0 WHERE md5 = '339a150f79a8c8d125ad8c' at line 1ERROR 'latin-1' codec can't encode characters in position 62-63: ordinal not in range(256)
这个错误为,str插入数据库,str有中文参与,需要数据库进行支持,解决办法:
cur.execute("CREATE DATABASE %s default charset utf8 collate utf8_unicode_ci" % operationDB.dbName)
default charset utf8 collate utf8_unicode_ci 至关重要!
其次,每一次连接数据库也需要设置charset:
pymysql.connect("localhost", dbUser, dbPassword, dbName, charset="utf8")
综上即可解决该问题!
阅读全文
0 0
- python3 web.py
- ubuntu 配置python3.4、web.py、libxml2, libxslt, lxml python
- CentOS下Nginx+fastcgi+python3搭建web.py服务环境
- web.py (url.py)
- web.py
- web.py
- web.py
- web.py
- Python(21):用web.py搭一个服务端(python3)
- 原创-web.py开发
- REST web.py
- web.py 0.3 教程
- web.py 进阶例程
- web.py session 应用
- web.py性能测试
- lighttpd + web.py
- web.py学习随笔
- nginx + uwsgi+web.py
- 预处理、结构体预习
- Cordova plugin 调用本地 notification
- Android Studio使用问题
- tomcat启动时间过短导致启动失败
- JQuery从服务器获取数据
- python3 web.py
- 两篇Qt多线程使用心得,写的不错
- 解决eclipse字体背景变红或者变绿的问题
- JavaScript DOM
- 超出用省略号代替
- Linux下编译mongo的c++链接库
- openshift提升用户为系统管理员
- 点击外部区域 隐藏输入法
- java异常处理关键字trows,trow,catch,finally代表什么意义?