Closed gwenxia closed 6 years ago
version information: os: centos7.0 python: 2.7.9 pypy: pypy-5.10.0-linux_x86_64-portable django: Django==1.10.2 mysql-python: mysql-python>=1.2.5
I have resloved this issue according to https://stackoverflow.com/questions/17272645/using-mysqldb-module-with-pypy-compiler.
1.execute cmd "pypy manage.py runserver 8888" under django project 2.throw exceptions: From thread 139719201711872 started by <function wrapper at 0x0000000001ee8f20>: Traceback (most recent call last): File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, kwargs) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/core/management/commands/runserver.py", line 113, in inner_run autoreload.raise_last_exception() File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception six.reraise(_exception) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(args, kwargs) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/init.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/apps/config.py", line 199, in import_models self.models_module = import_module(models_module_name) File "/opt/pypy-5.10.0-linux_x86_64-portable/lib-python/2.7/importlib/init.py", line 37, in import_module import(name) File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/contrib/auth/models.py", line 4, in
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/contrib/auth/base_user.py", line 52, in
class AbstractBaseUser(models.Model):
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/models/base.py", line 119, in new
new_class.add_to_class('_meta', Options(meta, app_label))
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/models/base.py", line 316, in add_to_class
value.contribute_to_class(cls, name)
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/models/options.py", line 214, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/init.py", line 33, in getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/utils.py", line 211, in getitem
backend = load_backend(db['ENGINE'])
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/utils.py", line 115, in load_backend
return import_module('%s.base' % backend_name)
File "/opt/pypy-5.10.0-linux_x86_64-portable/lib-python/2.7/importlib/init.py", line 37, in import_module
import(name)
File "/opt/pypy-5.10.0-linux_x86_64-portable/operation-env/site-packages/django/db/backends/mysql/base.py", line 32, in
from MySQLdb.constants import CLIENT, FIELD_TYPE # isort:skip
ImportError: No module named MySQLdb