Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 499481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:59:23+00:00 2026-05-13T05:59:23+00:00

There were some excellent answers to this question already, however, they are now outdated.

  • 0

There were some excellent answers to this question already, however, they are now outdated.

I’ve been able to get the module installed, but “python manage.py runserver” fails with

 iMac:myproject drhoden$ python manage.py runserver
 Validating models...
 Unhandled exception in thread started by <function inner_run at 0x10496f0>
 Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/commands/runserver.py", line 48, in inner_run
     self.validate(display_num_errors=True)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/base.py", line 249, in validate
     num_errors = get_validation_errors(s, app)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/management/validation.py", line 22, in get_validation_errors
     from django.db import models, connection
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py", line 41, in <module>
     backend = load_backend(settings.DATABASE_ENGINE)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/__init__.py", line 17, in load_backend
     return import_module('.base', 'django.db.backends.%s' % backend_name)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
     __import__(name)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 13, in <module>
     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dynamic module does not define init function (init_mysql)

 ^CiMac:segisys drhoden$ 

Likewise, from the python shell:

iMac:myproject drhoden$ python
Python 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.3-fat/egg/MySQLdb/__init__.py", line 19, in <module>

  File "build/bdist.macosx-10.3-fat/egg/_mysql.py", line 7, in <module>
  File "build/bdist.macosx-10.3-fat/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dynamic module does not define init function (init_mysql)
>>> 

Using MySQL-python-1.2.3c1 with setuptools-0.6c11-py2.6.egg

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:59:24+00:00Added an answer on May 13, 2026 at 5:59 am

    I have ultimately solved my own problem, with of course, the subconscious and conscious help from the many posts, blogs, and mail logs I’ve read. I would give links if I could remember.

    In a nutshell, I reinstalled EVERYTHING using MacPorts.

    After editing ~/.bash_profile and commenting out all the previous modifications to ${PATH}, I downloaded the dmg for Snow Leopard and ran through its installation.

    Then opened the terminal and ran the self update.

    sudo port selfupdate
    sudo port install python26
    

    That second part, installing Python 2.6, took forever. But when it completed it prompted me with the following:

    To fully complete your installation and make python 2.6 the default, please run
    
    sudo port install python_select  
    sudo python_select python26
    

    I did both and they went quick.

    I forgot to mention how handy ‘port search ‘ command is. I searched for ‘mysql’ and similar to find the thing to type after ‘install’. But I proceeded with reinstalling both the client and server for MySQL. Perhaps I did this in reverse order, but the end result worked fine.

    sudo port install mysql5
    ...
    --->  Installing mysql5 @5.1.41_0
    The MySQL client has been installed.
    If you also want a MySQL server, install the mysql5-server port.
    

    So naturally:

    sudo port install mysql5-server
    

    I love how the so many of the macports installations give you feedback as to what to do next. At the end of the server installation, it said the following:

    ******************************************************
    * In order to setup the database, you might want to run
    * sudo -u _mysql mysql_install_db5
    * if this is a new install
    ******************************************************
    

    It was a new install for me (didn’t have any local schemas). For completeness, and for my own reference, here is the output of running that command:

    Installing MySQL system tables...
    OK
    Filling help tables...
    OK
    
    To start mysqld at boot time you have to copy
    support-files/mysql.server to the right place for your system
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    /opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'
    /opt/local/lib/mysql5/bin/mysqladmin -u root -h iMac.local password 'new-password'
    
    Alternatively you can run:
    /opt/local/lib/mysql5/bin/mysql_secure_installation
    
    which will also give you the option of removing the test
    databases and anonymous user created by default.  This is
    strongly recommended for production servers.
    
    See the manual for more instructions.
    
    You can start the MySQL daemon with:
    cd /opt/local ; /opt/local/lib/mysql5/bin/mysqld_safe &
    
    You can test the MySQL daemon with mysql-test-run.pl
    cd /opt/local/mysql-test ; perl mysql-test-run.pl
    
    Please report any problems with the /opt/local/lib/mysql5/bin/mysqlbug script!
    
    The latest information about MySQL is available at http://www.mysql.com/
    Support MySQL by buying support/licenses from http://shop.mysql.com/
    

    Almost done. Earlier in my ‘port search’ing I came across this interesting port:

    py26-mysql @1.2.2 (python, devel, databases)
    Python interface to mysql

    With much, much hope that this would provide me with MySQLdb package, I installed it (and it did).

    sudo port install py26-mysql
    

    Afterwords I cranked up the python interpreter attempted to import MySQLdb, the very thing in my way all this time.

    iMac:~ drhoden$ python
    Python 2.6.4 (r264:75706, Dec 15 2009, 18:00:14) 
    [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MySQLdb
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/MySQLdb/__init__.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet
    >>> 
    

    A warning, but It worked!!

    Just one more thing:

    sudo port install py26-django
    

    After all of this I was finally able to crank up my Django project and remotely connect to my company’s MySQL server!! It may not have been necessary to reinstall Django using MacPorts, but I wasn’t going to risk complications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TTR has some excellent TA indicators. Is there a package or function that calculates
I'm using the excellent jEditable plugin for some in-place editing on my page. There
Edited after getting answers Some excellent answers here. I like Josh's because it is
I've been searching through the Devise RDocs, Google, on this site for answers to
Are there some good resources tutorials or anyone has tried to implement a Capcha
Is there some way to define an abstract type as a parameter in an
Is there some kind of software that I can feed uploaded images to and
Is there some crucial difference in writing the registry class in MVC with magic
Is there some way to use Tuning Advisor for SQL Express? Is there some
Is there some event I can use to tell when the SelectedIndices property changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.