Django CMS: Error while setting up django-cms - python

I'm having a WSGI error while following the installation set up for django-cms from th official documentation.
I ran test with python manage.py cms check and it was sucessful.
Checking django CMS installation
Sekizai
Sekizai is installed [OK]
Sekizai template context processor is installed [OK]
Sekizai namespaces 'js' and 'css' found in 'home.html' [OK]
Plugin instances
================
Plugin instances of 0 types found in the database [OK]
The plugins in your database are in good order [OK]
Presence of "copy_relations"
All plugins and page/title extensions have "copy_relations" method if needed. [OK]
PlaceholderField
PlaceholderField configuration okay [OK]
OVERALL RESULTS
9 checks successful!
Installation okay
But when I try running server, I get this thread of errors.
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
July 22, 2022 - 08:47:41
Django version 3.2.14, using settings 'projcms.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\utils\module_loading.py", line 13, in import_string
module_path, class_name = dotted_path.rsplit('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
module = import_module(module_path)
File "C:\Users\adedi\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\projcms\wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
self.load_middleware()
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
middleware = import_string(middleware_path)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\utils\module_loading.py", line 15, in import_string
raise ImportError("%s doesn't look like a module path" % dotted_path) from err
ImportError: djangocms_text_ckeditor doesn't look like a module path
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\adedi\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "C:\Users\adedi\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
handler = self.get_handler(*args, **options)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
return get_internal_wsgi_application()
File "C:\Users\adedi\Documents\Dev\Projects\Django\dj-cms\env\lib\site-packages\django\core\servers\basehttp.py", line 47, in get_internal_wsgi_application
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: WSGI application 'projcms.wsgi.application' could not be loaded; Error importing module.
I have inspected my code and can't seem to find any answer.

Related

Unable to Run Django-Spirit raise InvalidTemplateLibrary( django.template.library.InvalidTemplateLibrary

I am trying to Run django-spirit and followed the documentation https://spirit.readthedocs.io/en/latest/installation.html
and using version django-spirit 0.12.3
i followed as bellow
Get started
New in Spirit 0.5
Latest version can be installed through pip:
Install Spirit:
pip install django-spirit
Start your site:
spirit startproject mysite
Set up the database:
cd mysite
python manage.py spiritinstall
Create an administrator account:
python manage.py createsuperuser
python manage.py runserver
python manage.py makermigrations
python manage.py migrate
when i push python manage.py runserver command it thorugh the bellow error.
i have checked out the database too and its empy no tables/database is created
i am using python 3.9 and the requirements versions as per the project requirements
struggling since yesterday but no success
PS C:\Users\gsminfinity.com\Desktop\gsminfinity.com\Spirit-master\community> python manage.py runserver
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\utils.py", line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\spirit\core\templatetags\spirit_tags.py", line 3, in <module>
from spirit.comment import tags as comment
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\spirit\comment\tags.py", line 11, in <module>
from .forms import CommentForm
ImportError: cannot import name 'CommentForm' from partially initialized module 'spirit.comment.forms' (most likely due to a circular import) (C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\spirit\comment\forms.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
self.run()
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 392, in check
all_issues = checks.run_checks(
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\admin\checks.py", line 78, in check_dependencies
for engine in engines.all():
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\utils.py", line 90, in all
return [self[alias] for alias in self]
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\utils.py", line 90, in <listcomp>
return [self[alias] for alias in self]
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\utils.py", line 81, in __getitem__
engine = engine_cls(params)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\django\template\backends\django.py", line 123, in get_package_libraries
raise InvalidTemplateLibrary(
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'spirit.core.templatetags.spirit_tags': cannot import name 'CommentForm' from partially initialized module 'spirit.comment.forms' (most likely due to a circular import)
(C:\Users\gsminfinity.com\AppData\Local\Programs\Python\Python39\lib\site-packages\spirit\comment\forms.py)

Django runserver error: _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 139824587568800

After adding 'rest_framework.authtoken' to INSTALLED_APPS (settings.py) and running python manage.py migrate I started to get a strange error when trying to run django server (the strange thing is, that the error appears on every 2nd or 3rd attempt, sometimes the server starts running without the error):
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/utils.py", line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/username/anaconda3/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/username/anaconda3/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/core/management/base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/core/management/base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/contrib/admin/checks.py", line 79, in check_dependencies
for engine in engines.all():
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/utils.py", line 90, in all
return [self[alias] for alias in self]
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/utils.py", line 90, in <listcomp>
return [self[alias] for alias in self]
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/utils.py", line 81, in __getitem__
engine = engine_cls(params)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/backends/django.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/template/backends/django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/rest_framework/templatetags/rest_framework.py", line 12, in <module>
from rest_framework.renderers import HTMLFormRenderer
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/rest_framework/renderers.py", line 19, in <module>
from django.test.client import encode_multipart
File "/home/username/.local/share/virtualenvs/blogapi-nhgDNK6P/lib/python3.7/site-packages/django/test/client.py", line 23, in <module>
from django.test import signals
File "<frozen importlib._bootstrap>", line 980, in _find_and_load
File "<frozen importlib._bootstrap>", line 149, in __enter__
File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 139824587568800
I am using: django 2.2.7 and django rest_framework 3.10.3. Thanks for any help.
There's a ticket on Django's issue tracker discussing similar issue: https://code.djangoproject.com/ticket/30352.
For a temporary fix, you can remove all .pyc files on your project and run the runserver command again.
find <path-to-your-project> -type f -name '*.pyc' -delete
NB: I use pyenv which stores the project's virtual environment in a different directory outside the project directory. Removing only the project's .pyc files work for me, but you may also try removing the virtual environment's .pyc files if needed.
For anyone who still gets this error, please kindly comment in the issue page to help Django developers reproduce and fix the error.

Facing trouble in running python manage.py runserver

I am trying to run python manage.py runserver and till today I never faced any issues. Whenever I run python manage.py runserver I get this-
$ python manage.py runserver
Performing system checks...
System check identified no issues (0 silenced).
August 11, 2019 - 05:34:42
Django version 2.1.5, using settings 'try_django.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f0b20e6d6a8>
Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.7/site-packages/django/utils/module_loading.py", line 13, in import_string
module_path, class_name = dotted_path.rsplit('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/home/user/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/user/Dev/try_django_new/src/try_django/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
return WSGIHandler()
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 136, in __init__
self.load_middleware()
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/handlers/base.py", line 34, in load_middleware
middleware = import_string(middleware_path)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/utils/module_loading.py", line 15, in import_string
raise ImportError("%s doesn't look like a module path" % dotted_path) from err
ImportError: blog doesn't look like a module path
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/anaconda3/lib/python3.7/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 137, in inner_run
handler = self.get_handler(*args, **options)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
return get_internal_wsgi_application()
File "/home/user/anaconda3/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 50, in get_internal_wsgi_application
) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'try_django.wsgi.application' could not be loaded; Error importing module.
I looked for solutions and found out that in the settings.py file I should change WSGI_APPLICATION = 'application' to WSGI_APPLICATION = 'wsgi.application' but it was already so in my settings.py file.
Based on the error it looks like you have an entry of simply 'blog' in your MIDDLEWARE settings. Django middleware requires a path to a class so 'blog' is not a valid value.
That's based on these lines from your traceback:
middleware = import_string(middleware_path)
File "/home/user/anaconda3/lib/python3.7/site-packages/django/utils/module_loading.py", line 15, in import_string
raise ImportError("%s doesn't look like a module path" % dotted_path) from err
ImportError: blog doesn't look like a module path
Django's server needs to find your application as defined in wsgi.py, so you need to set `WSGI_APPLICATION = '<project-name>.wsgi.application'.
See the docs at https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
which state:
WSGI servers obtain the path to the application callable from their configuration. Django’s built-in server, namely the runserver command, reads it from the WSGI_APPLICATION setting. By default, it’s set to
<project_name>.wsgi.application, which points to the application callable in <project_name>/wsgi.py.

Django Crispy Forms

I am fairly new to Django and I have installed and am trying to use crispy forms in my web app.I have added crispy_forms to my installed apps with a comma after it. When I run the server I get this error:
Watching for file changes with StatReloader
Performing system checks...
Exception in thread Thread-3:
Traceback (most recent call last):
File "c:\users\amart\django\django\template\utils.py", line 66, in __getitem__
return self._engines[alias]
KeyError: 'django'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\amart\django\django\template\backends\django.py", line 121, in get_package_libraries
module = import_module(entry[1])
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\crispy_forms\templatetags\crispy_forms_field.py", line 10, in <module>
from crispy_forms.utils import TEMPLATE_PACK, get_template_pack
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\crispy_forms\utils.py", line 11, in <module>
from django.utils.lru_cache import lru_cache
ModuleNotFoundError: No module named 'django.utils.lru_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\amart\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "c:\users\amart\django\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "c:\users\amart\django\django\core\management\commands\runserver.py", line 117, in inner_run
self.check(display_num_errors=True)
File "c:\users\amart\django\django\core\management\base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "c:\users\amart\django\django\core\management\base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "c:\users\amart\django\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "c:\users\amart\django\django\contrib\admin\checks.py", line 59, in check_dependencies
for engine in engines.all():
File "c:\users\amart\django\django\template\utils.py", line 90, in all
return [self[alias] for alias in self]
File "c:\users\amart\django\django\template\utils.py", line 90, in <listcomp>
return [self[alias] for alias in self]
File "c:\users\amart\django\django\template\utils.py", line 81, in __getitem__
engine = engine_cls(params)
File "c:\users\amart\django\django\template\backends\django.py", line 25, in __init__
options['libraries'] = self.get_templatetag_libraries(libraries)
File "c:\users\amart\django\django\template\backends\django.py", line 43, in get_templatetag_libraries
libraries = get_installed_libraries()
File "c:\users\amart\django\django\template\backends\django.py", line 108, in get_installed_libraries
for name in get_package_libraries(pkg):
File "c:\users\amart\django\django\template\backends\django.py", line 125, in get_package_libraries
"trying to load '%s': %s" % (entry[1], e)
django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'crispy_forms.templatetags.crispy_forms_field': No module named 'django.utils.lru_cache'
I don't know what is wrong with my code. I have found some other users who have issues using crispy forms but are getting a different error. They were also unable to import crispy forms from the python shell but that is working for me. Even if I only add crispy forms to my installed apps without trying to apply it in my templates, I still get an error. Please let me know what I'm doing wrong. Thanks in advance.
Your version of django-crispy-forms is outdated, this has been fixed.
Update it by running:
pip install django-crispy-forms -U
-U makes pip upgrade your current installation to the newest.
You can find more about it by running pip install -h
The problem has been solved. I uninstalled the django version I had and used:
pip install Django==2.1.7
Thank you #YugandharChaudhari for helping me realize to change versions.

Django Apache mod_wsgi - Unable to open database file

After upgrading mod_wsgi to the latest version, my app can no longer access its caching db (sqlite).
The Apache error log shows the following:
mod_wsgi (pid=1050): Target WSGI script '/location/to_my_project/project_name/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=1050): Exception occurred processing WSGI script '/location/to_my_project/project_name/wsgi.py'.
aceback (most recent call last):
File "/location/to_my_project/project_name/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/location/to/my/env/lib/python3.5/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
return WSGIHandler()
File "/location/to/my/env/lib/python3.5/site-packages/django/core/handlers/wsgi.py", line 153, in __init__
self.load_middleware()
File "/location/to/my/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 80, in load_middleware
middleware = import_string(middleware_path)
File "/location/to/my/env/lib/python3.5/site-packages/django/utils/module_loading.py", line 20, in import_string
module = import_module(module_path)
File "/location/to/my/env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/location/to_my_project/project_name/middleware/some_middleware.py", line 16, in <module>
include_get_headers=True,
File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/core.py", line 182, in install_cache
backend = backends.create_backend(backend, cache_name, backend_options)
File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/__init__.py", line 50, in create_backend
return registry[backend_name](cache_name, **options)
File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/sqlite.py", line 28, in __init__
self.responses = DbPickleDict(location + extension, 'responses', fast_save=fast_save)
File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/storage/dbdict.py", line 58, in __init__
with self.connection() as con:
File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/location/to/my/env/lib/python3.5/site-packages/requests_cache/backends/storage/dbdict.py", line 70, in connection
con = sqlite.connect(self.filename)
sqlite3.OperationalError: unable to open database file
The user running the process, has however created the file after the error has occurred. When logging in with that user, I can also open / edit the file. Other users with the same problem have reported that changing the path to the file from absolute to relative have solved their issue, but mine has been relative all along. the cache is also created in the correct directory.
mod_wsgi version: 4.5.14 (previous version 4.3.0)
Django: 1.10
Apache: 2.4.18
Server: Ubuntu 16.04
I have not changed the python path after upgrading the wsgi module. Any suggestions on what might be wrong?

Categories