Jump to content

[SOLVED] Django, Python 2,7 and MySQL support


Alex Boyce

Recommended Posts

I can connect to my MySQL database from a simple python script in the cgi-bin folder when it uses version 2.4 (the default). But when I use Python 2.7, it fails to import MySQLdb (which would explain my Django exceptions). I looked in the site-packages folders for both versions, /usr/lib/python2.4/site-packages and /usr/local/lib/python2.7/site-packages, and only Python 2.4 has the MySQL package.

 

I know that Django uses Python 2.7 and I can't change it. So is MySQL supported with DJango on Heliohost? It doesn't appear to be installed.

 

Also, why is the path for Python 2.7 /usr/local/lib and for Python 2.4 it is /usr/lib. Is that the problem?

 

 

Link to comment
Share on other sites

Are you on johnny? My django app running python 2.7 and using mysql is fine.

 

 

I think so. How can I verify it? The url for CPanel is http://johnny.heliohost.org:2082/frontend/x3/index.html

Is that sufficient?

 

Where are you picking up MySQLdb from? Maybe I have a path problem. My python2.7 path is:

['/home/aboyce/public_html/cgi-bin',

'/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',

'/usr/local/lib/python2.7/site-packages/bottle-0.9.2-py2.7.egg',

'/usr/local/lib/python2.7/site-packages/django_simple_captcha-0.3.0-py2.7.egg',

'/usr/local/lib/python27.zip',

'/usr/local/lib/python2.7',

'/usr/local/lib/python2.7/plat-linux2',

'/usr/local/lib/python2.7/lib-tk',

'/usr/local/lib/python2.7/lib-old',

'/usr/local/lib/python2.7/lib-dynload',

'/usr/local/lib/python2.7/site-packages']

 

and the site-packages folder looks like this:

['setuptools-0.6c11-py2.7.egg',

'README',

'django',

'setuptools.pth',

'django_simple_captcha-0.3.0-py2.7.egg',

'easy-install.pth',

'bottle-0.9.2-py2.7.egg',

'Django-1.3-py2.7.egg-info']

which is no where near as much as the python 2.4 site-packages folder.

 

For reference, python 2.4 has this path:

['/home/aboyce/public_html/cgi-bin',

'/usr/lib/python2.4/site-packages/hashlib-20081119-py2.4-linux-x86_64.egg',

'/usr/lib/python2.4/site-packages/elementtree-1.2.7_20070827_preview-py2.4.egg',

'/usr/lib/python2.4/site-packages/psycopg2-2.2.1-py2.4-linux-x86_64.egg',

'/usr/lib/python2.4/site-packages/ipython-0.10-py2.4.egg',

'/usr/lib/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-x86_64.egg',

'/usr/lib64/python24.zip',

'/usr/lib64/python2.4',

'/usr/lib64/python2.4/plat-linux2',

'/usr/lib64/python2.4/lib-tk',

'/usr/lib64/python2.4/lib-dynload',

'/usr/lib64/python2.4/site-packages',

'/usr/lib64/python2.4/site-packages/PIL',

'/usr/lib64/python2.4/site-packages/gtk-2.0',

'/usr/lib/python2.4/site-packages']

and its site-packages folder contains:

['libusermodule.so',

'psycopg2-2.2.1-py2.4-linux-x86_64.egg',

'_snackmodule.so',

'elementtree-1.2.7_20070827_preview-py2.4.egg',

'yum',

'django',

'setuptools',

'site.pyc',

'easy_install.pyo',

'iniparse',

'hashlib-20081119-py2.4-linux-x86_64.egg',

'elementtree',

'pkg_resources.pyc',

'site.py',

'cracklibmodule.so',

'snack.pyc',

'MySQL_python-1.2.3-py2.4-linux-x86_64.egg',

'setuptools-0.6c7-py2.4.egg-info',

'urlgrabber',

'snack.py',

'easy-install.pth',

'pkg_resources.py',

'ipython-0.10-py2.4.egg',

'rpmUtils',

'easy_install.py',

'pkg_resources.pyo',

'oddjobmodule.so',

'site.pyo',

'web',

'sos',

'easy_install.pyc',

'facebook.py',

'snack.pyo']

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...