Django Pinax-notifications errors

129 Views Asked by At

I am trying to work with the django pinax-notifications and do not manage to migrate the database. I have followed every steps of the pinax installation tutorial. Is it something to do with the django Pinax template. I have also several times tried to delete the files in my migrations folder.

https://github.com/pinax/pinax-notifications

I have the following error:

File "C:\portal\dashboard\core\urls.py", line 11, in <module>
    re_path("app/", include(('app.urls','app'), namespace='app')),
  File "C:\portal\dashboard\env\lib\site-packages\django\urls\conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "C:\Program Files\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:\portal\dashboard\app\urls.py", line 3, in <module>
    from app import views
  File "C:\portal\dashboard\app\views.py", line 18, in <module>
    NoticeType.create(
  File "C:\portal\dashboard\env\lib\site-packages\pinax\notifications\models.py", line 47, in create
    notice_type = cls._default_manager.get(label=label)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\query.py", line 425, in get
    num = len(clone)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\query.py", line 269, in __len__
    self._fetch_all()
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\query.py", line 1308, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\models\sql\compiler.py", line 1156, in execute_sql
    cursor.execute(sql, params)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\utils.py", line 98, in execute
    return super().execute(sql, params)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "C:\portal\dashboard\env\lib\site-packages\django\db\backends\sqlite3\base.py", line 413, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: pinax_notifications_noticetype

urls.py

urlpatterns = [
    # other urls
    url(r"^notifications/", include("pinax.notifications.urls", namespace="pinax_notifications")),
]

settings.py

INSTALLED_APPS = [

    'pinax',
    'pinax.notifications',  

]

apps.py

from django.apps import AppConfig

class HeatConfig(AppConfig):
    name = 'heat'

    def ready(self):
        from django.db.models.signals import post_migrate
        from .handlers import create_notice_types

        post_migrate.connect(create_notice_types, sender=self)

handlers.py

from pinax.notifications.models import NoticeType
from django.conf import settings
from django.utils.translation import ugettext_noop as _

def create_notice_types(sender, **kwargs): 
    NoticeType.create(
        "heat_detection", 
        _("Heat Detected"), 
        _("you have detected a heat record")
    )
0

There are 0 best solutions below