2

Running folllowing command

$python2.6 manage.py runserver 

Gives this an ouput:

Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
ImportError: No module named django.core.management

I tried many solutions out there but they are of no use.

When I try to install django again it using pip,

$ pip install django

It give following output:

Requirement already satisfied (use --upgrade to upgrade): django in /Library/Python/2.7/site-packages
Cleaning up...

And trying

$ pip freeze

Gives following output,

Django==1.5.4
MySQL-python==1.2.4
...
...
...
wsgiref==0.1.2
xattr==0.6.2
zope.interface==3.5.1

I dont know what to do? Please help I wasted the whole trying to run this successfully. Thanks.

UPDATE:

When I tried running

$ python2.7 manage.py runserver

it gives me following error

Validating models...

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x107e63050>>
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
    self.validate(display_num_errors=True)
  File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 280, in validate
    num_errors = get_validation_errors(s, app)
  File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
    from django.db import models, connection
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 40, in <module>
    backend = load_backend(connection.settings_dict['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 34, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "/Library/Python/2.7/site-packages/django/db/utils.py", line 27, in load_backend
    return import_module('.base', backend_name)
  File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/tg/.python-eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/tg/.python-eggs/MySQL_python-1.2.4-py2.7-macosx-10.8-intel.egg-tmp/_mysql.so

  Reason: image not found
Ganatra
  • 6,498
  • 3
  • 17
  • 16
  • looks like you forgot to activate the virtualenv – karthikr Sep 24 '13 at 20:39
  • are you using a virtualenv? 10.8 comes with Python 2.7 but your prompt seems to imply 2.6? Did you install a different Python? – Fraser Graham Sep 24 '13 at 20:45
  • 1
    As people have stated, it looks like you are using the wrong version of python. This `python2.7 manage.py runserver` should work assuming you installed 2.7 from source and used `make altinstall` – Ngenator Sep 24 '13 at 20:51
  • In response to your update, try taking a look at the answers to this question, they should solve your problem: http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib – Ngenator Sep 26 '13 at 06:13
  • thanks @Ngenator following command worked: `sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib` – Ganatra Oct 03 '13 at 10:47
  • @Ganatra Glad you got it working! – Ngenator Oct 03 '13 at 12:48

0 Answers0