"Unable to create the django_migrations table (%s)"

环境:python3 + django2.1 +pycharm +mysql 
执行python manage.py migrate时报错如下 
“Unable to create the django_migrations table (%s)” % exc 
django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, “You have an error in your SQL syntax; check the manual t 
hat corresponds to your MySQL server version for the right syntax to use near ‘(6) NOT NULL)’ at line 1”))

原因:django2.1 版本不再支持mysql5.5

阅读剩余部分 -

宫廷大戏《延禧攻略》泄露版全集下载

 

 

乾隆六年,少女魏璎珞为寻求长姐死亡真相,入紫禁城为宫女。经调查,璎珞证实姐姐之死与荒唐王爷弘昼有关,立志要讨回公道。富察皇后娴于礼法,担心璎珞走上歧途,竭力给予她温暖与帮助。在皇后的悉心教导下,魏璎珞一步步成长为正直坚强的宫廷女官,并放下怨恨、认真生活。皇后不幸崩逝,令璎珞对乾隆误会重重,二人从互相敌视到最终彼此理解、互相扶持。璎珞凭勇往直前的勇气、机敏灵活的头脑、宽广博大的胸怀,化解宫廷上下的重重困难,最终成为襄助乾隆盛世的令贵妃。直到璎珞去世前,她才将当年富察皇后临终托付告知乾隆,即望她陪伴弘历身边,辅助他做一个有为明君,乾隆终知富察氏用心良苦。乾隆六十年,乾隆帝宣示魏璎珞之子嘉亲王永琰为皇太子,同时追封皇太子生母令懿皇贵妃为孝仪皇后,璎珞终于用自己的一生,实现了对富察皇后的承诺。

 

阅读剩余部分 -

Python的MySQL驱动pymysql与mysqlclient性能对比

Python版本3.6

测试语句:

select * from FOO;

 

mysql终端直接执行:

46410 rows in set (0.10 sec)

 

 

python程序需安装profilehooks进行调用耗时分析

 

pymysql驱动测试程序:

# 安装:pip install pymysql

from profilehooks import profile
import pymysql.cursors
import pymysql
connection = pymysql.connect(host='localhost', user='root', db='foo')
c = connection.cursor()

@profile(immediate=True)
def read_by_pymysql():
    c.execute("select * from FOO;")
    res = c.fetchall()



read_by_pymysql()

阅读剩余部分 -

error: command 'gcc' failed with exit status 1 on CentOS7 错误解决办法

安装 pip3 install mysqlclient 的时候报错


Collecting mysqlclient
Downloading https://pypi.doubanio.com/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz (90kB)
100% |████████████████████████████████| 92kB 4.1MB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vzxpixzp/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hfv6f_7w-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.6/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-3.6/MySQLdb
creating build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.6/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/www/server/mysql/include -I/usr/include/python3.6m -c _mysql.c -o build/temp.linux-x86_64-3.6/_mysql.o -g -DNDEBUG
_mysql.c:37:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-vzxpixzp/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hfv6f_7w-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vzxpixzp/mysqlclient/
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

 

阅读剩余部分 -

Nginx设置expires设定页面缓存时间 不缓存或一直使用缓存

配置expires
expires起到控制页面缓存的作用,合理的配置expires可以减少很多服务器的请求
要配置expires,可以在http段中或者server段中或者location段中加入

       location ~ \.(gif|jpg|jpeg|png|bmp|ico)$ {
           root /var/www/img/;
           expires 30d;
       }

控制图片等过期时间为30天,当然这个时间可以设置的更长。具体视情况而定
比如

       location ~ \.(wma|wmv|asf|mp3|mmf|zip|rar|swf|flv)$ {
               root /var/www/upload/;
               expires max;
       }

expires 指令可以控制 HTTP 应答中的“ Expires ”和“ Cache-Control ”的头标(起到控制页面缓存的作用)
语法:expires [time|epoch|max|pff]
默认值:off
expires指令控制HTTP应答中的“Expires”和“Cache-Control”Header头部信息,启动控制页面缓存的作用
time:可以使用正数或负数。“Expires”头标的值将通过当前系统时间加上设定time值来设定。
time值还控制"Cache-Control"的值:
负数表示no-cache
正数或零表示max-age=time

阅读剩余部分 -

王者荣耀兵线刷新时间

00:10.0 
00:43.2 
01:16.5 
01:49.8 
02:23.0 
02:56.2 
03:29.5 
04:02.7 

04:05后


04:36.0 
05:09.3 
05:42.5 
06:15.7 
06:49.0 
07:22.3 
07:55.5 
08:28.7 

09:00后


09:02.0 
09:35.2 
10:08.5 
10:41.8 
11:15.0 
11:48.2 
12:21.5 
12:54.8 

13:00后

阅读剩余部分 -

解决Python3下打印utf-8字符串出现UnicodeEncodeError的问题

最近在对bismarck进行升级,主要是从Python2迁移到Python3,并更换爬取方案。

结果出师不利,在将爬取到的商品标题print出来时,抛出错误:

  root@fb6e7c6fbe5c:/home/binss# python3 amazon_test.py
  Traceback (most recent call last):
  File "amazon_test.py", line 30, in
  print(s)
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)

Python2时代最怕就是这个UnicodeEncodeError,没想到到了Python3,又见到它了。

查看第一个字符,发现为'\u8266',于是测试以下代码:

  >>> print('\u8266')

果然报错

  Traceback (most recent call last):
  File "", line 1, in
  UnicodeEncodeError: 'ascii' codec can't encode character '\u8266' in position 0: ordinal not in range(128)

尝试了各种姿势,结果还是没能解决。

最后突发奇想,print不行,那我把其输出到文件捏?

阅读剩余部分 -

最新文章

归档

其它

链接

meiyoutongji