1

Integrating client project with pinax-notifications for notification kind of functionality.

  *File "/home/user/Shwetha/ramble/ramble/rambleapp/urls.py", line 56, in <module>
    url(r"^notifications/", include("pinax.notifications.urls", namespace="pinax_notifications")),
  File "/home/user/.local/lib/python3.6/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/usr/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 "/home/user/.local/lib/python3.6/site-packages/pinax/notifications/urls.py", line 3, in <module>
    from .views import NoticeSettingsView
  File "/home/user/.local/lib/python3.6/site-packages/pinax/notifications/views.py", line 5, in <module>
    from .compat import login_required
  File "/home/user/.local/lib/python3.6/site-packages/pinax/notifications/compat.py", line 12, in <module>
    from account.decorators import login_required
  File "/home/user/.local/lib/python3.6/site-packages/account/decorators.py", line 5, in <module>
    from account.utils import handle_redirect_to_login
  File "/home/user/.local/lib/python3.6/site-packages/account/utils.py", line 13, in <module>
    from .models import PasswordHistory
  File "/home/user/.local/lib/python3.6/site-packages/account/models.py", line 26, in <module>
    class Account(models.Model):
  File "/home/user/.local/lib/python3.6/site-packages/django/db/models/base.py", line 116, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class account.models.Account doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.*

As per the https://github.com/pinax/pinax-notifications#documentation Documentation , it was installed and configured. Encountered the above error while configuring.

Already tried:

  1. In settings.py, INSTALLED_APPS section add both pinax and pinax-notifications.
  2. Added Sites in INSTALLED_APPS and made SITE_ID=1 in settings.py.
  3. verbose_name added in apps.py.

All the above does not seem to solve the problem. Please advise.

  • https://stackoverflow.com/a/62772698/11282077 this would help I hope – Siva Sankar Mar 17 '21 at 18:33
  • The model in the error is in `account/models.py` that does not look like the package you link to. Pinax is trying to import that in a try-except (expecting an import error) in case you are using [django-user-accounts](https://github.com/pinax/django-user-accounts) (another package from pinax). You import succeeds as perhaps you have installed that app or some other with a similar name. The problem is this app is not in `INSTALLED_APPS`. Likely the problem is you aren't using a virtual environment for your python projects. – Abdul Aziz Barkat Mar 17 '21 at 18:35
  • I tried now. That Class Meta : app_label = "name_of_your_app" is not working. – Shwetha Maiya Mar 17 '21 at 18:38
  • @AbdulAzizBarkat INSTALLED_APPS: 'myapp', 'pinax', 'pinax.notifications', – Shwetha Maiya Mar 17 '21 at 18:40
  • myapp has views, models, templates and signals at the same level. Signals has the handlers.py which create notice types. apps.py is as follows: `from django.apps import AppConfig from django.db.models.signals import post_migrate from myapp.signals import handlers class MyappConfig(AppConfig): name = 'myapp' verbose_name = 'myapp' def ready(self): post_migrate.connect(handlers.create_notice_types, sender=self)` – Shwetha Maiya Mar 17 '21 at 18:49
  • Adding 'account' to the INSTALLED_APPS in settings.py solved the problem! Thanks everyone. – Shwetha Maiya Mar 18 '21 at 09:25
  • @AbdulAzizBarkat Solved. – Shwetha Maiya Mar 18 '21 at 09:25

0 Answers0