开发者

Django + OsX Lion + Mysql with XAMPP

开发者 https://www.devze.com 2023-04-02 04:02 出处:网络
I have the following on my MacBook with Osx Lion: Mysql running with xampp (http://www.apachefriends.org/it/xampp.html)

I have the following on my MacBook with Osx Lion:

  • Mysql running with xampp (http://www.apachefriends.org/it/xampp.html)
  • Django 1.3 running in a virtualenv

I installed Mysql-python with pip install MySQL-python

but when trying to use manage.py syncdb I get the following error:

(django_1.3)Daniel-Mac:fz_biblio daniel$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 14, in <module>
    execute_manager(settings)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/__init__.py", line 67, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/commands/syncdb.py", line 7, in <module>
    from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/core/management/sql.py", line 6, in <module>
    from django.db import models
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/__init__.py", line 78, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/dj开发者_如何学运维ango/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/utils.py", line 33, in load_backend
    return import_module('.base', backend_name)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so, 2): no suitable image found.  Did find:
        /Users/daniel/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.7-i386.egg-tmp/_mysql.so: mach-o, but wrong architecture
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate "/Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py
> "
(django_1.3)Daniel-Mac:fz_biblio daniel$ mate /Users/daniel/Sites/django-proj/virtual-env/django_1.3/lib/python2.5/site-packages/django/db/backends/mysql/base.py

Any idea in order to make django work with mysql in my environment?!?!


I finally sorted out the problem installing the right version of MySQL for my machine.

I installed MySQL 64bit version --> Mac OS X ver. 10.6 (x86, 64-bit)

After installing it Everything started working fine. I guess it was due to the fact that my previous installation was a 32bit one, that why mysql-python was complaining for the wrong architecture.

0

精彩评论

暂无评论...
验证码 换一张
取 消