Closed nsomaru closed 8 years ago
@yakky can you help?
You are attempting to hit the database before it is guaranteed that all migrations etc have been run.
The line:
if not configs.exists():
results in a database query. Try to have it that this test is not made until later.
I cannot reproduce the issue using this sample project: https://github.com/yakky/sample-project Possibly some import in your custom code which triggers the early import of cms_app code?
@yakky in your sample project djangocms_blog/cms_app.py does not get imported. The problem is then djangocms_apphook_setup/base.py as @schinckel mentioned.
Why would you want to import cms_app? This is handled by django CMS itself
Yes, but in your case djangocms_blog/cms_app.py is not imported by CMS. I don't know what you need to change in the sample project so it does. The import (by CMS) trigers the bug.
https://github.com/nephila/djangocms-apphook-setup/blob/master/djangocms_apphook_setup/base.py#L150
This line gets called too early in our cases.
@honzahosek django CMS loads the cms_app.py
file without the need of importing it somewhere in the code, it's all handled automatically
@yakky I do NOT import it anywhere in my code.
In your https://github.com/yakky/sample-project is the djangocms_blog/cms_app.py not loaded by CMS. Put breakpoint or 1/0 to that file and you will see it does not get hit.
To replicate problem use https://github.com/yakky/sample-project and: delete db.sqlite3 add url(r'^cms/', include('cms.urls')), to your urls.py pip install django-extensions python manage.py show_urls
I see that you use django-debug-toolbar quick setup. I guess that's the cause of the error. django CMS needs debug toolbar explicit setup (see http://docs.django-cms.org/en/develop/upgrade/3.0.html?highlight=explicit#upgrading-from-2-4)
And AFAIK running show_urls
without a database it's not supported in django CMS (due to the way apphooks urls are handled)
I updated the sample project with working django-debug-toolbar configuration
Thanks for the debug-tooblar advise.
show_urls
was first thing which triggered the same problem. In my setup I got it on any python manage.py
Closing this Feel free to reopen if you encounter more issues
I've fallen onto this issue with a fresh installation. i am using django-cms v4 which could introduce it's own set of issues. The issue appears to be because the cms's app registration tries to load modules in, including the wizards. It falls over because the following logic tries to run imediatley when the codeis loaded, prompting a call to a model that doesn't yet have migrations. You can't created migrations because any manage.py command fails for the same reason.
Commenting out the following code allowed me to continue, I then uncommented once I had ran python manage.py migrate
https://github.com/nephila/djangocms-blog/blob/d18382808766548c0ec1b9f0dabe443d5430aebf/djangocms_blog/cms_wizards.py#L100
working with django 4.2, with djangocms v4 , getting same error did it require to comment out the hole code after line 100
for config in BlogConfig.objects.all().order_by("namespace"): seed = slugify("{}.{}".format(config.app_title, config.namespace)) new_wizard = type(str(seed), (PostWizard,), {}) new_form = type("{}Form".format(seed), (PostWizardForm,), {"default_appconfig": config.pk}) post_wizard = newwizard( title=("New {0}").format(config.object_name), weight=200, form=newform, model=Post, description=("Create a new {0} in {1}").format(config.object_name, config.app_title), ) try: wizard_pool.register(post_wizard) except AlreadyRegisteredException: # pragma: no cover if settings.DEBUG: raise else: warnings.warn( f"Wizard {seed} cannot be registered. Please make sure that " f"BlogConfig.namespace {config.namespace} and BlogConfig.app_title {config.app_title} are" "unique together", stacklevel=2, )
@rdawad Unfortunately ther's no support for Django CMS 4 as of now: we'll work on that but it'll take some time
Hi,
I'm trying to install djangocms_blog after successfully installing django-cms.
I've followed the installation guide up to the point of migration. But either syncdb or migrate give me this error:
Traceback
Settings
Packages
Any guidance would be appreciated.