简体   繁体   English

django用mysql运行服务器错误

[英]django run server error with mysql

After I solve the issue with "image not found" when I run python manage.py syncdb by adding "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/" into .bash_profile. 在我运行python manage.py syncdb通过在.bash_profile中添加“ export DYLD_LIBRARY_PATH = / usr / local / mysql / lib /”来解决“找不到图像”的问题后, The problem comes with python manage.py runserver Does anyone know how to solve OSError(Errno 20)? 该问题来自python manage.py runserver有人知道如何解决OSError(Errno 20)吗?

System check identified no issues (0 silenced).
October 07, 2014 - 18:19:56
Django version 1.8, using settings 'dbtest.settings'
Starting development server at http:/127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/__init__.py", line 330, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/__init__.py", line 322, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/base.py", line 363, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/base.py", line 412, in execute
    output = self.handle(*args, **options)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/commands/runserver.py", line 80, in handle
    self.run(**options)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/core/management/commands/runserver.py", line 89, in run
    autoreload.main(self.inner_run, None, options)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 320, in main
    reloader(wrapped_main_func, args, kwargs)
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 286, in python_reloader
    reloader_thread()
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 262, in reloader_thread
    change = fn()
  File "/Library/Python/2.7/site-packages/Django-1.8-py2.7.egg/django/utils/autoreload.py", line 200, in code_changed
    stat = os.stat(filename)
OSError: [Errno 20] Not a directory: '/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.9-intel.egg/MySQLdb/converters.py'

I just realize that I install both mysql-python and mysql-connector-python packages. 我只是意识到我同时安装了mysql-python和mysql-connector-python软件包。 By changing the database 'ENGINE' setting from 'django.db.backends.mysql' to 'mysql.connector.django', the issue is solved. 通过将数据库“ ENGINE”设置从“ django.db.backends.mysql”更改为“ mysql.connector.django”,此问题得以解决。

Lesson learned here: I should probably use virtualenv to try different python package. 在这里学习到的教训:我可能应该使用virtualenv尝试不同的python包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM