python manage.py runserver not working on Macbook 10.8 - python

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

Related

ImportError: No module named social_django.middleware.in import_module __import__(name)

Hello I am trying to execute a project that is made in django 1.10.8 and pyhon 2.7 and the python_social_auth library. When I try to execute the project I get the following error.I hope you can help me
manage.py runserver
Unhandled exception in thread started by <function wrapper at 0x7f4b908eb488>
Traceback (most recent call last):
File "/home/mauricio/.local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 39, in inner_run
http_consumer=self.get_consumer(*args, **options),
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/management/commands/runserver.py", line 134, in get_consumer
return StaticFilesConsumer()
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/handler.py", line 327, in __init__
self.handler = self.handler_class()
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/staticfiles.py", line 18, in __init__
super(StaticFilesHandler, self).__init__()
File "/home/mauricio/.local/lib/python2.7/site-packages/channels/handler.py", line 177, in __init__
self.load_middleware()
File "/home/mauricio/.local/lib/python2.7/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/home/mauricio/.local/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named social_django.middleware
Try this
The Python executable you use to run the application doesn't have social_django installed. You can verify this by running these commands:
python manage.py shell
import social_django
This will give you an error, for the same reason.
You can install it with:
pip install social-auth-app-django

No module named django_select2

I'm trying to run an example from the django-SHOP framework. Following their tutorial on running the example, I get the following error:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/home/agozie/anaconda3/envs/env1/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django_select2
I've installed django_select2 but it still throws the error. Any ideas?
Installing stripe through conda throws the error
CondaValueError: too few arguments, must supply command line package specs or --file
Is it installed?
Please run:
pip install django_select2
If you're using anaconda, try:
conda install -c django_select2
You can also do:
activate /home/agozie/anaconda3/envs/env1
pip install django_select2

Hue Installation Issue - Mac OS

I am trying to setup Hue on my Mac.
This is the GitHub link I referred to:
https://github.com/cloudera/hue#development-prerequisites
$ git clone https://github.com/cloudera/hue.git
$ cd hue
$ make apps
Getting this error:: when running build/env/bin/hue runserver
hue soundarya$ build/env/bin/hue runserver
Validating models...
Unhandled exception in thread started by <function wrapper at 0x108be1cf8>
Traceback (most recent call last):
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/commands/runserver.py", line 102, in inner_run
self.validate(display_num_errors=True)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/soundarya/virtenv/hue_venv/hue/apps/jobbrowser/src/jobbrowser/models.py", line 20, in <module>
import lxml.html
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib
Referenced from: /Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so
Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
Can anyone help me with this issue?
Prerequisites are not yet satisfied. You have to install all the requirements listed here: Development Prerequisites. To ged rid of this error, you have to install python2.7-dev package(not python2.7-devel) and also other requirements.

ImportError: No module named pyorbited.simple while running django-orbited

I am trying to run test project of django-orbited. When I execute python manage.py runserver, the following error occurs:
Unhandled exception in thread started by <bound method Command.inner_run of
<django.core.management.commands.runserver.Command object at 0x8ea994c>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/prashant/grambox/django-orbited/testing/django_orbited/models.py", line 2, in <module>
from pyorbited.simple import Client as OrbitedClient
ImportError: No module named pyorbited.simple
I have installed orbited using command pip install orbited. I tried changing pyorbited.simple to orbited.simple, but the error persists. Does anyone have any idea how to solve it?
Value in sys.path:
/usr/local/lib/python2.7/dist-packages/pip-1.2.1-py2.7.egg
/usr/local/lib/python2.7/dist-packages/jqmobile-1.0_pre_alpha-py2.7.egg
/usr/lib/python2.7
/usr/lib/python2.7/plat-linux2
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PIL
/usr/lib/python2.7/dist-packages/gst-0.10
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/dist-packages/ubuntuone-client
/usr/lib/python2.7/dist-packages/ubuntuone-control-panel
/usr/lib/python2.7/dist-packages/ubuntuone-couch
/usr/lib/python2.7/dist-packages/ubuntuone-installer
/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol
/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode
You installed orbited but you need to install pyorbited.
I can reproduce the same issue with only orbited installed:
% sudo pip install orbited
% python
>>> import orbited # yes, this works but it's not what you need
>>> from pyorbited.simple import Client as OrbitedClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pyorbited.simple
On the other hand, once we install pyorbited, it works:
% sudo pip install pyorbited
% python
>>> from pyorbited.simple import Client as OrbitedClient
>>>

Django Local Installation syncdb ImproperlyConfigured

I have been struggling to get a local django installation set up on a mac osx10.6.8. Running syncdb fails to recognize the apps that I have installed.
admins-macbook:myproject Admin$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/Admin/myapp/lib/python2.7/site-packages/south/management/commands/__init__.py", line 10, in <module>
import django.template.loaders.app_directories
File "/Users/Admin/myapp/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 23, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError haystack: cannot import name openProc
I have installed all the apps in the requirements.txt and they exist in the
lib/python2.7/site-packages/
directory. It is on my pythonpath:
admins-macbook:myproject Admin$ echo $PATH
/Users/Admin/myapp/lib/python2.7/site-packages:(... etc.)
How can I properly run syncdb? Thanks for your ideas!
you may installed pip install haystack which is wrong.
you need to install dyango haystack by pip install django-haystack
please refer this SO question

Categories