I've recently renamed project and its apps. When I run development server through Windows command line it works correctly. The problem is that when I run server through PyCharm (I've set virtualenv), it says (I've recently installed django-allauth):
Unhandled exception in thread started by <function wrapper at 0x03767B30>
Traceback (most recent call last):
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\utils\autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\core\management\commands\runserver.py", line 107, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\utils\autoreload.py", line 252, in raise_last_exception
six.reraise(*_exception)
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\utils\autoreload.py", line 229, in wrapper
fn(*args, **kwargs)
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Milano\Desktop\Projekty\venvs\sflvenv\lib\site-packages\django\apps\config.py", line 86, in create
module = import_module(entry)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named allauth
What I've done:
Replaced all apps with new names, project too.
Removed .idea folder to make PyCharm create fresh new.
Set virtualenv
What should I do to make it work?
Install the package while your virtualenv is activated:
pip install django-allauth
If you're sure you have it installed, try this:
No Allauth-specific context processors are listed in your Django project settings. So you need to remove these two lines:
# `allauth` specific context processors
'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount',
A relevant SO thread
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 had a working mezzanine project configured with apache and mod_wsgi. I tried to added an app to the project and restarted apache and suddenly the project is throwing the error even after undoing the changes. Getting the same error when I'm trying to run python manage.py check:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 284, in execute
self.validate()
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name, True)
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 97, in load_app
app_module = import_module(app_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/mezzanine/boot/__init__.py", line 16, in <module>
from django.apps import apps
ImportError: No module named apps
Path to django: "/usr/local/lib/python2.7/dist-packages/django", and it has folder named "apps" and "init.py" file exists inside the folder.
I then created a whole new mezzanine project and ran python manage.py check, and getting the same error. It means not any mezzanine project is working. I tried updating and reinstalling django and mezzanine but no use. On the other hand, a simple django project is running fine.
It seems there is some problem with mezzanine.
I went through the other related questions but couldn't get it resolved. Any help would be much appreciated. Thanks in advance.
You say you have a folder named apps in your Django installation, but the traceback shows it is executing code that was removed in 1.7, the same version that introduced django.apps. Your installation is most likely corrupt and has files from different versions.
Uninstall Django from your Python installation, and completely remove the /usr/local/lib/python2.7/dist-pacakges/django/ folder. Then, reinstall a Django version that is compatible with your version of Mezzanine.
It seems that you've installed Django into your global Python installation. This can easily cause such problems when multiple projects need to use different versions of python packages. It is recommended to use a virtual environment to manage requirements for your projects in an isolated environment and prevent such conflicts.
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
I have a simple django project. Installed python,django and mysql database in my ubuntu to run this project. In order to run my project I am trying to sync database first. But when I am trying command "python manage.py syndb" I am getting following errors:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 429, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 252, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 101, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/lib/python2.7/dist-packages/django/conf/__init__.py", line 139, in __init__
logging_config_func(self.LOGGING)
File "/usr/lib/python2.7/logging/config.py", line 777, in dictConfig
dictConfigClass(config).configure()
File "/usr/lib/python2.7/logging/config.py", line 562, in configure
'filter %r: %s' % (name, e))
ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.RequireDebugFalse': No module named RequireDebugFalse
I am very new to python and django. doing it first time..
django.utils.log.RequireDebugFalse appeared in Django 1.4.0. Could it be you have an older Django version installed ?
As you stated in the comment, you installed Django from your distro's repository. Those versions are often old, and indeed it looks like you have installed version 1.3, which is now three versions out of date.
You should remove that version (with apt-get remove) and install the current version from the Python package index, via pip install django. You will probably need to install pip first, which you can do with apt-get.