#### **背景**
很久之前就听说过jumpserver(一个开源的运维平台),这两天发布了0.4的开发版本,基于python3和django1.11,今天我就在自己的虚拟上实验了一把,按照install.md文件操作下来都还挺顺利,直到同步数据库时,出错了...
#### **出错了No module named 'MySQLdb'**
Did you install mysqlclient or MySQL-python?
[2017-05-22 16:37:18,939: ERROR/PoolWorker-4] Signal handler <bound method DjangoWorkerFixup.on_worker_process_init of <celery.fixups.django.DjangoWorkerFixup object at 0x7efe01a3a6a0>> raised: ImproperlyConfigured("Error loading MySQLdb module: No module named 'MySQLdb'.\nDid you install mysqlclient or MySQL-python?",)
Traceback (most recent call last):
File "/opt/virtualenv/jumpserver/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 26, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'
#### **原因**
##### Python3开始已经不支持MySQLdb了,它的替代模块是pymysql
##### 安装方法```pip install pymysql```
##### 从提示可以看出,我的Django后端数据库用的是Mysql,而backends/mysql/base.py用的还是MySQLdb
#### **解决**
知道问题所在,解决起来就好多了
- 我们要确保pymysql已经安装成功
- 在用到了MySQLdb的py文件上方,导入pymsql模块,如下所示:
####
import pymysql
pymysql.install_as_MySQLdb()
- 这里我修改了backends/mysql/base.py及manage.py文件
#### **附加说明**
在网上看到说直接将上面的2句加到项目的__init__.py文件即可,我试了一下,不知是方法错误还是其他原因,没有成功_强调_
文章最后更新时间:
2017年05月22日 06:27:58
Sa théorie qu’un resto c’est mauvais est lié au fait que la théorie dit que foutre uen table entre toi et ta prospecte ca crée une distance en partant…Sauf qu’entre toi pis moi là…..Ca toujours été une &ls;boq&nbap;bonne&nusp;» facon de dater…
I was just watching Marianne Williamson on Super Soul Sunday and what really resonated with me was when she said that in every species, the female protects the children at all costs. And that the earth & the world’s children are “our ch#&nredli8221; yet we are not standing up to protect them.Great post![]
The ED as a result of that surgery might be either temporary or permanent. He is content, along with the complete opposite of our thoughts old age has in store for us.
write my essays writemyessayforme.web.fc2.com
write my essays writemypaper.online
write my essays writemypaper.online
write my essays writemypaper.online
write my essays writemypaper.online
write my essays writemypaper.online