django.db.utils.ProgrammingError: column _____ does not exist - python

There are a lot of similar posts to this but none that I have found seem to resolve the program. I have tried to add a field to a custom user model that inherits from Django's AbstractUser:
class AppUser(AbstractUser):
credibility_rating = models.FloatField(default=0)
When I save this and try to run python manage.py makemigrations it gives me this error:
Traceback (most recent call last):
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column api_appuser.credibility_rating does not exist
LINE 1: ...ppuser"."is_active", "api_appuser"."date_joined", "api_appus...
When I replace the field credibility_rating with pass the error goes away. Similarly, when I try to add a new field in a different model, the error doesn't occur either. I am not sure if this matters, but I am using Postgres. My settings.py file does include AUTH_USER_MODEL = "api.AppUser" where api is the name of my app. I am not sure where I am going wrong. Thank you for any help.
Full traceback:
Traceback (most recent call last):
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column api_appuser.credibility_rating does not exist
LINE 1: ...ppuser"."is_active", "api_appuser"."date_joined", "api_appus...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/jhcscomputer1/Desktop/senior_project/senior_project/manage.py", line 22, in <module>
main()
File "/Users/jhcscomputer1/Desktop/senior_project/senior_project/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/management/base.py", line 455, in execute
self.check()
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/management/base.py", line 487, in check
all_issues = checks.run_checks(
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/urls/resolvers.py", line 480, in check
for pattern in self.url_patterns:
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/urls/resolvers.py", line 696, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/utils/functional.py", line 49, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/urls/resolvers.py", line 689, in urlconf_module
return import_module(self.urlconf_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 "/Users/jhcscomputer1/Desktop/senior_project/senior_project/senior_project/urls.py", line 21, in <module>
path('api/', include('api.urls'))
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/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 "/Users/jhcscomputer1/Desktop/senior_project/senior_project/api/urls.py", line 2, in <module>
from . import views
File "/Users/jhcscomputer1/Desktop/senior_project/senior_project/api/views.py", line 21, in <module>
for user in AppUser.objects.all():
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/models/query.py", line 320, in __iter__
self._fetch_all()
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/models/query.py", line 1507, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/models/query.py", line 57, in __iter__
results = compiler.execute_sql(
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1361, in execute_sql
cursor.execute(sql, params)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 103, in execute
return super().execute(sql, params)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/jhcscomputer1/.local/share/virtualenvs/senior_project-hOu14Mps/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column api_appuser.credibility_rating does not exist
LINE 1: ...ppuser"."is_active", "api_appuser"."date_joined", "api_appus...

Related

I have a problem importing openai in Django for web application purposes

My python version is able to run open ai on its own, but when I tried to integrate it with Django I ran into the following issue:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1031, in _bootstrap_inner
self.run()
^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 968, in run
self._target(*self._args, **self._kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
self.check(display_num_errors=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/management/base.py", line 475, in check
all_issues = checks.run_checks(
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/urls/resolvers.py", line 494, in check
for pattern in self.url_patterns:
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/urls/resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 902, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/matthewsetiawan/Desktop/Final Year Project/OpenCare/Main Project/OpenCare/loanhub/urls.py", line 21, in <module>
path('',include('authentication.urls')),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/django/urls/conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 902, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/matthewsetiawan/Desktop/Final Year Project/OpenCare/Main Project/OpenCare/authentication/urls.py", line 3, in <module>
from . import views
^^^^^^^^^^^^^^^^^^^
File "/Users/matthewsetiawan/Desktop/Final Year Project/OpenCare/Main Project/OpenCare/authentication/views.py", line 13, in <module>
import openai
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/__init__.py", line 9, in <module>
from openai.api_resources import (
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/__init__.py", line 1, in <module>
from openai.api_resources.completion import Completion # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/completion.py", line 4, in <module>
from openai.api_resources.abstract import DeletableAPIResource, ListableAPIResource
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/abstract/__init__.py", line 3, in <module>
from openai.api_resources.abstract.api_resource import APIResource
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/abstract/api_resource.py", line 4, in <module>
from openai import api_requestor, error, util
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 21, in <module>
import aiohttp
^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/__init__.py", line 6, in <module>
from .client import (
^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/aiohttp/client.py", line 34, in <module>
from yarl import URL
^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/yarl/__init__.py", line 1, in <module>
from ._url import URL, cache_clear, cache_configure, cache_info
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/yarl/_url.py", line 11, in <module>
from ._quoting import _Quoter, _Unquoter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/yarl/_quoting.py", line 14, in <module>
from ._quoting_c import _Quoter, _Unquoter # type: ignore[misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "yarl/_quoting_c.pyx", line 1, in init yarl._quoting_c
ValueError: builtins.type size changed, may indicate binary incompatibility. Expected 904 from C header, got 896 from PyObject
I have not been able to find my issue anywhere else on the web as this module is relatively new, however could anyone give some insights on this issue. Perhaps it has something to do with setting.py file?

Getting mistake after creating success_url with CreateView class

Sorry for my bad English in advance.
I'm trying to discover django, so I decided to write my own sign in/sign up views.
So I just wrote something like that -
class RegisterView(CreateView):
template_name = 'auth/user_create_form.html'
model = User
fields = ['username', 'password', 'email']
So, it's basically working with GET requests. We can see the form on specified url.
But after altering all fields and submitting form, I've got a mistake what suggested to specify get_absolute_url for model to redirect after submitting. So I decided to give success_url to RegisterView -
class RegisterView(CreateView):
template_name = 'auth/user_create_form.html'
model = User
fields = ['username', 'password', 'email']
success_url = reverse('words:main_page')
And got a mistake
Exception in thread django-main-thread:
Traceback (most recent call last):
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 600, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/linuxbrew/.linuxbrew/opt/python#3.9/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/home/linuxbrew/.linuxbrew/opt/python#3.9/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/utils/autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/core/management/base.py", line 419, in check
all_issues = checks.run_checks(
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/core/checks/registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/core/checks/urls.py", line 23, in check_resolver
return check_method()
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 598, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 591, in urlconf_module
return import_module(self.urlconf_name)
File "/home/linuxbrew/.linuxbrew/opt/python#3.9/lib/python3.9/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 "/home/yegor/projects/word_collector/word_collector/urls.py", line 23, in <module>
path('', include('words.urls'))
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/home/linuxbrew/.linuxbrew/opt/python#3.9/lib/python3.9/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 "/home/yegor/projects/word_collector/words/urls.py", line 2, in <module>
from words.views import MainView, RegisterView, LoginView
File "/home/yegor/projects/word_collector/words/views.py", line 12, in <module>
class RegisterView(CreateView):
File "/home/yegor/projects/word_collector/words/views.py", line 17, in RegisterView
success_url = reverse('words:main_page')
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/base.py", line 54, in reverse
app_list = resolver.app_dict[ns]
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 526, in app_dict
self._populate()
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 460, in _populate
for url_pattern in reversed(self.url_patterns):
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/yegor/.cache/pypoetry/virtualenvs/word-collector-g9LS8W6v-py3.9/lib/python3.9/site-packages/django/urls/resolvers.py", line 607, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf 'word_collector.urls' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
I'm sure that urlconf is great. Where this thing getting circular import? And how I should use success_url?
By the way, if I assign POST method to class -
def post(self, *args, **kwargs):
self.success_url = reverse('words:main_page')
return super().post(*args, **kwargs)
then everything work properly, but I still don't understand why?

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f197e469a60>

hi guys i'm working in project with cms called tendenci which required to work with PostgreSQL and python django, I've been working on it on a virtual machine with Ubuntu and when i tried to migrate to production server (with Ubuntu also) i faced a lot of issues the last is migrate the db, actually i did all the required steps but it still showing an error when i try to run the server
this is the command that i run
python manage.py runserver
this is the error that i get
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7fadbc707a60>
Traceback (most recent call last):
File "/srv/mysite/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: relation "site_settings_setting" does not exist
LINE 1: SELECT (1) AS "a" FROM "site_settings_setting" WHERE ("site_...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/mysite/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/srv/mysite/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 124, in inner_run
self.check(display_num_errors=True)
File "/srv/mysite/lib/python3.6/site-packages/django/core/management/base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "/srv/mysite/lib/python3.6/site-packages/django/core/management/base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "/srv/mysite/lib/python3.6/site-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/srv/mysite/lib/python3.6/site-packages/django/core/checks/urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "/srv/mysite/lib/python3.6/site-packages/django/core/checks/urls.py", line 26, in check_resolver
return check_method()
File "/srv/mysite/lib/python3.6/site-packages/django/urls/resolvers.py", line 256, in check
for pattern in self.url_patterns:
File "/srv/mysite/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/srv/mysite/lib/python3.6/site-packages/django/urls/resolvers.py", line 407, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/srv/mysite/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/srv/mysite/lib/python3.6/site-packages/django/urls/resolvers.py", line 400, in urlconf_module
return import_module(self.urlconf_name)
File "/srv/mysite/lib/python3.6/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 "/var/www/clients/client1/web1/web/mysite/conf/urls.py", line 6, in <module>
from tendenci.urls import handler500 # noqa: F401
File "/srv/mysite/lib/python3.6/site-packages/tendenci/urls.py", line 18, in <module>
registry_autodiscover()
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/registry/register.py", line 21, in autodiscover
import_module('%s.app_registry' % app)
File "/srv/mysite/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/entities/app_registry.py", line 18, in <module>
site.register(Entity, EntityRegistry)
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/registry/sites.py", line 157, in register
cache_reg_apps(self.get_registered_apps())
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/registry/sites.py", line 177, in get_registered_apps
apps = RegisteredApps(self._registry)
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/registry/sites.py", line 44, in __init__
if check_setting(*setting_tuple):
File "/srv/mysite/lib/python3.6/site-packages/tendenci/apps/site_settings/utils.py", line 156, in check_setting
scope_category=scope_category, name=name).exists()
File "/srv/mysite/lib/python3.6/site-packages/django/db/models/query.py", line 673, in exists
return self.query.has_results(using=self.db)
File "/srv/mysite/lib/python3.6/site-packages/django/db/models/sql/query.py", line 517, in has_results
return compiler.has_results()
File "/srv/mysite/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 858, in has_results
return bool(self.execute_sql(SINGLE))
File "/srv/mysite/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
raise original_exception
File "/srv/mysite/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 889, in execute_sql
cursor.execute(sql, params)
File "/srv/mysite/lib/python3.6/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/srv/mysite/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/srv/mysite/lib/python3.6/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/srv/mysite/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/srv/mysite/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "site_settings_setting" does not exist
LINE 1: SELECT (1) AS "a" FROM "site_settings_setting" WHERE ("site_...
i don't know if there is a problem with the db or there is somthing else

Make migrations error in django: "no such table"

when I was trying to make migrations: python manage.py makemigrations
The following error occurred: django.db.utils.OperationalError: no such table: blog_category
Traceback (most recent call last):
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django \db\backends\sqlite3\base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: blog_category
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django \core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 361, in execute
self.check()
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 390, in check
include_deployment_checks=include_deployment_checks,
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 377, in _run_checks
return checks.run_checks(**kwargs)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\checks\urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 571, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\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 "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\bona_blog\urls.py", line 27, in <module>
path('', include('blog.urls', namespace='blog')), # Urls for article app.
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\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 "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\blog\urls.py", line 5, in <module>
from blog.views.blog.article_views import (
File "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\blog\views\blog\article_views.py", line 25, in <module>
from blog.forms.blog.article_forms import (
File "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\blog\forms\blog\article_forms.py", line 16, in <module>
class ArticleCreateForm(forms.ModelForm):
File "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\blog\forms\blog\article_forms.py", line 18, in ArticleCreateForm
class Meta:
File "C:\xampp\htdocs\Django project\blooper\Bona-Blog-master\blog\forms\blog\article_forms.py", line 47, in Meta
"data-live-search": "true"
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\forms\widgets.py", line 562, in __init__
self.choices = list(choices)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\query.py", line 274, in __iter__
self._fetch_all()
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\query.py", line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\query.py", line 55, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\sql\compiler.py", line 1097, in execute_sql
cursor.execute(sql, params)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 99, in execute
return super().execute(sql, params)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "C:\Users\injemam\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\sqlite3\base.py", line 383, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: blog_category
Please Help How to remove this error?
I'm new in Django and I had clone this project from Github
https://github.com/Williano/Bona-Blog
using Django-2.2
Apparantly,
Either you have changed your db tables manually (e.g. via db interface)
You are missing one or more of required migration files.
As you are on a development environment I would suggest
drop the db
re-create the db
then python manage.py migrate again
This seams to be a bug in the blog software.
When the migrations are created the models in the code are introspected and in this process many modules are imported with the models. In the software there is a point where a query is made at import time (article_forms.py, line 40. At this point the table the query points to does not exist yet and it fails.
It is possible the author did not notice the bug because he/she had the table already when doing the change. And he/she never created a new instance from scratch.
You should report it as a bug.
Since you are in development stage you can drop the db and recreate it. But before recreating delete all the previous migration files on all the apps. Make sure that there are only lnlt files in those folders
python manage.py makemigrations
python manage.py migrate
This fixed it for me!
This question is old but I am putting a solution that worked for me as no one else has mentioned it yet. Also this could have just been a comment but I need 50 reputations to pull a comment, which I do not have at the time of writing this.
Instead of running project-wide migrations, make it specific to the blog app:
python manage.py makemigrations blog
python manage.py migrate blog
Do this for your other apps.

Django error code can't figure out what issue is

I am getting the following stack can not figure out what the issue is.
I know its to do with my URLS.pi i am trying to do a tasty pie url to setup a Restfull Service
ImportError: importlib._bootstrap is not a frozen module
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 339, in urlconf_module
return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 101, in get_response
resolver_match = resolver.resolve(request.path_info)
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 318, in resolve
for pattern in self.url_patterns:
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 346, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 341, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in <module>
from myarticle.api import ArticleResource
File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in <module>
from tastypie.resources import ModelResource
File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 1742, in <module>
class BaseModelResource(Resource):
File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 2212, in BaseModelResource
#transaction.commit_on_success()
File "/usr/local/lib/python3.3/dist-packages/django/db/transaction.py", line 448, in commit_on_success
PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bin/user_wsgi_wrapper.py", line 67, in __call__
self.error_log_file.logger.exception("Error running WSGI application")
File "/usr/lib/python3.3/logging/__init__.py", line 1269, in exception
self.error(msg, *args, **kwargs)
File "/usr/lib/python3.3/logging/__init__.py", line 1262, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python3.3/logging/__init__.py", line 1368, in _log
self.handle(record)
File "/usr/lib/python3.3/logging/__init__.py", line 1377, in handle
if (not self.disabled) and self.filter(record):
File "/usr/lib/python3.3/logging/__init__.py", line 687, in filter
for f in self.filters:
File "/bin/user_wsgi_wrapper.py", line 59, in __call__
app_iterator = self.app(environ, start_response)
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
response = self.get_response(request)
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 196, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 69, in technical_500_response
html = reporter.get_traceback_html()
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 323, in get_traceback_html
c = Context(self.get_traceback_data())
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 281, in get_traceback_data
frames = self.get_traceback_frames()
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 428, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 379, in _get_lines_from_file
source = loader.get_source(module_name)
File "<frozen importlib._bootstrap>", line 605, in _requires_frozen_wrapper
ImportError: importlib._bootstrap is not a frozen module
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 339, in urlconf_module
return self._urlconf_module
AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 90, in get_response
response = middleware_method(request)
File "/usr/local/lib/python3.3/dist-packages/django/middleware/common.py", line 71, in process_request
if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 573, in is_valid_path
resolve(path, urlconf)
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 453, in resolve
return get_resolver(urlconf).resolve(path)
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 318, in resolve
for pattern in self.url_patterns:
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 346, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python3.3/dist-packages/django/core/urlresolvers.py", line 341, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python3.3/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 1022, in load_module
File "<frozen importlib._bootstrap>", line 1003, in load_module
File "<frozen importlib._bootstrap>", line 560, in module_for_loader_wrapper
File "<frozen importlib._bootstrap>", line 868, in _load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
File "/home/Cmaden/cmsite/cmsite/urls.py", line 4, in <module>
from myarticle.api import ArticleResource
File "/home/Cmaden/cmsite/myarticle/api.py", line 1, in <module>
from tastypie.resources import ModelResource
File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 1742, in <module>
class BaseModelResource(Resource):
File "/home/Cmaden/.local/lib/python3.3/site-packages/django_tastypie-0.11.1-py3.3.egg/tastypie/resources.py", line 2212, in BaseModelResource
#transaction.commit_on_success()
File "/usr/local/lib/python3.3/dist-packages/django/db/transaction.py", line 448, in commit_on_success
PendingDeprecationWarning, stacklevel=2)
PendingDeprecationWarning: commit_on_success is deprecated in favor of atomic.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/bin/user_wsgi_wrapper.py", line 67, in __call__
self.error_log_file.logger.exception("Error running WSGI application")
File "/usr/lib/python3.3/logging/__init__.py", line 1269, in exception
self.error(msg, *args, **kwargs)
File "/usr/lib/python3.3/logging/__init__.py", line 1262, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/lib/python3.3/logging/__init__.py", line 1368, in _log
self.handle(record)
File "/usr/lib/python3.3/logging/__init__.py", line 1377, in handle
if (not self.disabled) and self.filter(record):
File "/usr/lib/python3.3/logging/__init__.py", line 687, in filter
for f in self.filters:
File "/bin/user_wsgi_wrapper.py", line 59, in __call__
app_iterator = self.app(environ, start_response)
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/wsgi.py", line 206, in __call__
response = self.get_response(request)
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 196, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "/usr/local/lib/python3.3/dist-packages/django/core/handlers/base.py", line 231, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 69, in technical_500_response
html = reporter.get_traceback_html()
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 323, in get_traceback_html
c = Context(self.get_traceback_data())
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 281, in get_traceback_data
frames = self.get_traceback_frames()
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 428, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "/usr/local/lib/python3.3/dist-packages/django/views/debug.py", line 379, in _get_lines_from_file
source = loader.get_source(module_name)
File "<frozen importlib._bootstrap>", line 605, in _requires_frozen_wrapper
ImportError: importlib._bootstrap is not a frozen module
Problem seems to be solved by changing the decorator of patch_list() method (line 2190) in file resources.py file of tastypie from
#transaction.commit_on_success()
to
#transaction.atomic()
PendingDeprecationWarning on django / tastypie
should not tasypie developers change it as mentioned above ? I have just had this exact problem and followed your advice: change decorator #transaction.commit_on_success() to #transaction.atomic and it helped.

Categories