django-cms / djangocms-link

django CMS Link is a plugin for django CMS that allows you to add links on your site.
https://marketplace.django-cms.org/en/addons/browse/djangocms-link/
Other
34 stars 61 forks source link

no such table: cms_page #34

Closed jedie closed 9 years ago

jedie commented 9 years ago

If i try to run syncdb, i get this error:

$ ./manage.py syncdb
...
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/djangocms_link/cms_plugins.py", line 8, in <module>
    from djangocms_link.forms import LinkForm
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/djangocms_link/forms.py", line 9, in <module>
    class LinkForm(ModelForm):
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/djangocms_link/forms.py", line 12, in LinkForm
    page_link = PageSearchField(queryset=Page.objects.drafts(), label=_("Page"), required=False)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django_select2/fields.py", line 305, in __call__
    if not queryset and hasattr(cls, '_subclass_queryset'):
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/models/query.py", line 122, in __len__
    self._fetch_all()
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/models/query.py", line 966, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/models/query.py", line 265, in iterator
    for row in compiler.results_iter():
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 700, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/models/sql/compiler.py", line 786, in execute_sql
    cursor.execute(sql, params)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/backends/utils.py", line 81, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/utils/six.py", line 658, in reraise
    raise value.with_traceback(tb)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/home/jens/PyLucid_env/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 485, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: no such table: cms_page

Think the related code is: PageSearchField(queryset=Page.objects.drafts()

galuszkak commented 9 years ago

I faced this issue too. But I'm not sure if #36 is real fix for that.

yakky commented 9 years ago

This is likely due to either early imports of models somewhere or circular imports. Which django CMS version?

jedie commented 9 years ago

in my case: 3.0.9

yakky commented 9 years ago

any specific application in installed apps? I can't reproduce this

jedie commented 9 years ago
INSTALLED_APPS = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.sitemaps', 'django.contrib.staticfiles', 'django.contrib.messages', 'cms', 'djangocms_admin_style', 'djangocms_text_ckeditor', 'menus', 'sekizai', 'mptt', 'djangocms_file', 'djangocms_link', 'djangocms_picture', 'djangocms_video', 'cmsplugin_htmlsitemap', 'cmsplugin_pygments', 'reversion', 'reversion_compare', 'compressor', 'django_extensions', 'filer', 'easy_thumbnails', 'cmsplugin_filer_image', 'parler', 'taggit', 'taggit_autosuggest', 'django_select2', 'meta', 'meta_mixin', 'admin_enhancer', 'djangocms_blog', 'django_info_panel')
galuszkak commented 9 years ago

3.0.10 for me. I bet on early import of models.

galuszkak commented 9 years ago

Hi @yakky . I've created failing example here : https://github.com/galuszkak/djangocmslink_bug

If you have any question I will explain. This example will fail on ./manage.py migrate

yakky commented 9 years ago

Thanks @galuszkak ! Will look into this

kirschnj commented 9 years ago

Hello, I have the same problem. Any news on this?

pakal commented 9 years ago

Same problem, it indeed looks like an early lookup of DB, incompatible with the new django1.7 setup system, here:

File "/home/pakal/webapps/devs/ENV/lib/python2.7/site-packages/djangocms_link/forms.py", line 12, in LinkForm pagelink = PageSearchField(queryset=Page.objects.drafts(), label=("Page"), required=False)

I worked around this by removing djangocms-link from installed apps, sync'ing DBs, and then only installing djangocms-link (now that djangocms parent tables were setup).

marksweb commented 9 years ago

I'm getting the same issue here with a brand new project, empty database.

Django 1.7.7 and CMS 3.0.12

Traceback is as @pakal said;

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/contrib/admin/__init__.py", line 23, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/cms/admin/__init__.py", line 11, in <module>
    plugin_pool.plugin_pool.discover_plugins()
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/cms/plugin_pool.py", line 36, in discover_plugins
    load('cms_plugins')
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/cms/utils/django_load.py", line 56, in load
    get_module(app, modname, verbose, failfast)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/cms/utils/django_load.py", line 40, in get_module
    module = import_module(module_name)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/utils/importlib.py", line 46, in import_module
    __import__(name)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/djangocms_link/cms_plugins.py", line 8, in <module>
    from djangocms_link.forms import LinkForm
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/djangocms_link/forms.py", line 9, in <module>
    class LinkForm(ModelForm):
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/djangocms_link/forms.py", line 12, in LinkForm
    page_link = PageSearchField(queryset=Page.objects.drafts(), label=_("Page"), required=False)
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django_select2/fields.py", line 305, in __call__
    if not queryset and hasattr(cls, '_subclass_queryset'):
  File "/Users/mwalker/Sites/ENV/lib/python2.7/site-packages/django/db/models/query.py", line 145, in __nonzero__
    self._fetch_all()
yakky commented 9 years ago

@marksweb @galuszkak @pakal @jkirschner42 @jedie could you check if this branch https://github.com/yakky/djangocms-link/tree/fix_queryset fix the issue?

galuszkak commented 9 years ago

I'm testing now. :)

galuszkak commented 9 years ago

@yakky yes, it fixes the problem. You can merge this :+1: . Thanks!

galuszkak commented 9 years ago

Good job @yakky :)

arinker commented 9 years ago

Will you release this soon in 1.6?