When I write pip list, I can see django there. When I write import django in python shell, there is no error. But when I write python manage.py runserver it gives me the following error:
Unhandled exception in thread started by <function wrapper at 0x105838b18>
Traceback (most recent call last):
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
six.reraise(*_exception)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/apps/config.py", line 127, in create
import_module(entry)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
Related
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
I have setup a django server on centos 7. When I start the server, I encounter this error
Unhandled exception in thread started by <function wrapper at 0x32b6ed8>
Traceback (most recent call last):
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(*args, **kwargs)
File "/root/venv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/root/venv/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/root/venv/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/root/venv/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/root/venv/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named sslserver
Install the module in your Python distribution or virtualenv:
$ pip install django-sslserver
Add the application to your INSTALLED_APPS:
INSTALLED_APPS = (...
"sslserver",
...
)
Start a SSL-enabled debug server:
$ python manage.py runsslserver
and access app on https://localhost:8000 or start server on specified port:
$ python manage.py runsslserver 127.0.0.1:8000
I recently switched from using mac to using linux, and I've had to move my code base over. In the process, my Django app has stopped working -- the issue seems to be an ImportError, where I don't have the module named dal.
python manage.py runserver
Unhandled exception in thread started by <function wrapper at 0x7f1335da6d70>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named dal
I've had a look, but can't seem to find this issue elsewhere, so hoping that someone else might be able to help me out in fixing this!
Thanks!
This dependency should be missing in your environment. Add it by:
pip install dal
dal means django-autocomplete-light.
To install it with pip you should execute pip install django-autocomplete-light. Hope it helps
after running
python manage.py runserver 0.0.0.0:8000
I get this error message
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x7fefc10b9190>>
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 "/usr/local/lib/python2.7/dist-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import * # nopyflakes
File "/usr/local/lib/python2.7/dist-packages/cms/models/pagemodel.py", line 6, in <module>
from django.contrib.auth import get_permission_codename
ImportError: cannot import name get_permission_codename
I've checked out /django/contrib/auth/management/init.py
and the get_permission_codename function exists so I can't see why it's not getting imported.
First, make sure you have Django 1.6 or later installed, because that's when get_permission_codename was added.
The problem might be with old pyc files. You could get rid of these by uninstalling Django completely then reinstalling.
I am trying to convert a Django 1.3 app to Django 1.6. I am using the django-tracking package but when I start the runsever I get the following error:
Unhandled exception in thread started by <function wrapper at 0x10868e9b0>
Traceback (most recent call last):
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
self.validate(display_num_errors=True)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/tracking/models.py", line 5, in <module>
from django.contrib.gis.utils import HAS_GEOIP
ImportError: cannot import name HAS_GEOIP
The answer is here:
https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoip/#module-django.contrib.gis.geoip
In Django 1.6 the import needed has changed from:
from django.contrib.gis.utils import HAS_GEOIP
to:
from django.contrib.gis.geoip import HAS_GEOIP
You could try to install development version of django-tracking with
pip install git+https://github.com/bashu/django-tracking.git