Closed ay0000 closed 3 years ago
So I changed the dockerfile to set the user django as the owner of the /usr/local/lib/python3.6/site-packages/cms/migrations/
folder. This takes care of the permission denied problem but I'm now getting a duplicate key error.
Even after running manage.py flush and trying to initialize the demo manually, please see the output below
django@5c3aad691978:~$ ./manage.py initialize_shop_demo
Operations to perform:
Apply all migrations: admin, auth, authtoken, cms, cmsplugin_cascade, contenttypes, djangocms_text_ckeditor, easy_thumbnails, email_auth, filer, menus, paintbypattern, post_office, sessions, shop, shop_sendcloud, sites
Running migrations:
No migrations to apply.
Initializing project paintbypattern
No changes detected in app 'paintbypattern'
Operations to perform:
Apply all migrations: admin, auth, authtoken, cms, cmsplugin_cascade, contenttypes, djangocms_text_ckeditor, easy_thumbnails, email_auth, filer, menus, paintbypattern, post_office, sessions, shop, shop_sendcloud, sites
Running migrations:
No migrations to apply.
Installed 33 object(s) from 1 fixture(s)
The following CMS pages must be adjusted:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "cms_cmsplugin_path_4917bb44_uniq"
DETAIL: Key (path)=() already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/web/paintbypattern/management/commands/initialize_shop_demo.py", line 37, in handle
call_command('shop', 'check-pages', add_recommended=True)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 168, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/site-packages/shop/management/commands/shop.py", line 83, in handle
for k, msg in enumerate(self.create_recommended_pages(), 1):
File "/usr/local/lib/python3.6/site-packages/shop/management/commands/shop.py", line 148, in create_recommended_pages
self.publish_in_all_languages(page)
File "/usr/local/lib/python3.6/site-packages/shop/management/commands/shop.py", line 455, in publish_in_all_languages
copy_plugins_to_language(page, languages[0], language)
File "/usr/local/lib/python3.6/site-packages/cms/api.py", line 509, in copy_plugins_to_language
copied_plugins = copy_plugins.copy_plugins_to(plugins, placeholder, target_language)
File "/usr/local/lib/python3.6/site-packages/cms/utils/copy_plugins.py", line 20, in copy_plugins_to
old_parent_cache, no_signals))
File "/usr/local/lib/python3.6/site-packages/cms/models/pluginmodel.py", line 333, in copy_plugin
new_plugin.save()
File "/usr/local/lib/python3.6/site-packages/cms/models/pluginmodel.py", line 267, in save
super().save(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 749, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 787, in save_base
force_update, using, update_fields,
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 890, in _save_table
results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 929, in _do_insert
using=using, raw=raw,
File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 1204, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1394, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "cms_cmsplugin_path_4917bb44_uniq"
DETAIL: Key (path)=() already exists.
Found that this was related to django-treebeard. v.4.5 breaks things apparently.
Added django-treebeard==4.4
to requirements.txt and that fixed it
see here: https://github.com/django-cms/django-cms/issues/6980
What happened?
django-shop docker container fails to start on fresh install. It seems to try to write a migration to a folder than it doesn't actually have access to. I tried to change the user in the docker file from django to root but that just creates different problems.
See below
What should've happened instead?
Docker container should have started.
Steps to reproduce
Docker-compose version 1.28.2, build 67630359 Docker version 20.10.3, build 48d30b5 Python 3.7.9 Ubuntu 20.04 running on AWS