原创 解決mac _mysql.c:44:10: fatal error: ‘my_config.h‘ file not found

環境: mac os:10.15.4 mysql:8.0.19 通過Homebrew命令安裝 MySQL-python: 1.2.5 pip install MySQL-python ...... running bu

原创 解決 celery ValueError: invalid literal for int() with base 10

celery 接的是redis,redis需要配置祕密 django settings.py中設置 CELERY_BROKER_URL = "redis://:!f&U@#[email protected]:6379/0" 其中 re

原创 解決mysql8.0修改默認密碼

➜ ✗ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connecti

原创 解決Simplify chained comparison

現象如上圖,pycharm提示需要”Simplify chained comparison“,咋一看提示,需要把這行表達式寫的更簡化一些,看了好一會,發現並沒有邏輯上可以簡化的地方。後來改成elif inc_perc < 0.0

原创 解決vim自動退格

如上圖,在ide裏將一段代碼 粘貼到vim文件裏之後,就發生了這樣的情況 解決:在粘貼之前執行下面代碼,再粘貼就可以了 :set paste

原创 uuid1與uuid4的區別

python中默認有uuid的庫,那麼來區分一下其兩個方法的區別是什麼。 Python 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.

原创 一天的隨機時間

import random import datetime dt = datetime.datetime(2019, 1, 1, 0, 0, 0) + datetime.timedelta(seconds=random.randi

原创 版本號排序

需求:對 [‘4.3.17’, ‘4.3.16’, ‘4.3.9’…] 排序 分析,版本號雖然都是數字,但是不能按照字符的順序排列,因爲升序的話,‘4.3.16’ 會排在 ‘4.3.9’ 的前面,但實際上應該排在後面,所以我們需要

原创 dango 500

瀏覽器: http://localhost:8080/admin/ 控制檯只打印了下面的一行報錯,在無其他: GET /admin/ HTTP/1.1" 500 27 沒有其他的報錯提示,很難排查 我這個問題的原因是,DEBUG沒

原创 解決If you see valid patterns in the file then the issue is probably caused by a circular import

ImproperlyConfigured: The included urlconf '<module 'xx.urls' from './xx/urls.pyc'>' does not appear to have any pa

原创 解決oh my zsh Insecure completion-dependent directories detected

安裝oh my zsh 的命令 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -

原创 解決uwsgi開多少進程才能最大使用服務器

先來看一下我的服務器配置: [root@Y]# cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l 2 [root@Y]# cat /proc/cpuinfo |grep

原创 解決 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)

OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) fo

原创 解決fatal error: 'sasl.h' file not found

mac 上安裝python-ldap 的時候報錯如下: Modules/LDAPObject.c:18:10: fatal error: 'sasl.h' file not found #include <sasl.h>

原创 解決python ping測試

要用python實現兩臺機器建的ping測試,思路是用os庫去模擬ping的命令,實現如下 import os os.system('ping -c 1 -w 1 192.168.1.1') 返回值爲0或大於0的數字 當返回值是