I was trying to run the application using docker-compose
docker-compose up
visit localhost:8000
To land in the webpage
Traceback (most recent call last):
web_1 | File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
web_1 | response = get_response(request)
web_1 | File "./saleor/core/middleware.py", line 80, in middleware
web_1 | request.site = Site.objects.get_current()
web_1 | File "./saleor/site/patch_sites.py", line 24, in new_get_current
web_1 | site = self.prefetch_related('settings').filter(pk=site_id)[0]
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 306, in __getitem__
web_1 | qs._fetch_all()
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 1179, in _fetch_all
web_1 | self._result_cache = list(self._iterable_class(self))
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 53, in __iter__
web_1 | results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1068, in execute_sql
web_1 | cursor.execute(sql, params)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
web_1 | return super().execute(sql, params)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
web_1 | return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
web_1 | return executor(sql, params, many, context)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
web_1 | return self.cursor.execute(sql, params)
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
web_1 | raise dj_exc_value.with_traceback(traceback) from exc_value
web_1 | File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
web_1 | return self.cursor.execute(sql, params)
web_1 | django.db.utils.ProgrammingError: relation "django_site" does not exist
web_1 | LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si...
Operating system: Ubuntu 16.04
Browser: firefox, chrome
Have you run migrations inside of the docker after building it? We have a guide for it
https://saleor.readthedocs.io/en/latest/customization/docker.html
@Pacu2 thanks, I Was following the above docs
When I run docker-compose run web python3 manage.py collectstatic
I get the following errors
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, 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 288, in run_from_argv
self.execute(args, *cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(args, *options)
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 125, in list
for path in utils.get_files(storage, ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/saleor/static/assets'
Also If i run docker-compose run web python3 manage.py populatedb --createsuperuser PermissionError: [Errno 13] Permission denied: '/app/media'
The following works for me:
docker-compose down;
docker-compose build && \
docker-compose run --rm web /bin/sh -c \
'python3 manage.py migrate && \
python3 manage.py populatedb --createsuperuser' && \
docker-compose up -d
* Warning:*
Don't run docker-compose down; unless your'e sure you want to.
@stephenmoloney I'm still getting this errors
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 487, in get_or_create
return self.get(**lookup), False
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 403, in get
self.model._meta.object_name
saleor.product.models.DoesNotExist: Category matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, 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 288, in run_from_argv
self.execute(args, cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(args, *options)
File "/app/saleor/core/management/commands/populatedb.py", line 59, in handle
stdout=self.stdout)
File "/app/saleor/core/utils/random_data.py", line 237, in create_products_by_schema
how_many=how_many, create_images=create_images, stdout=stdout)
File "/app/saleor/core/utils/random_data.py", line 198, in create_products_by_type
category = get_or_create_category(schema['category'], placeholder_dir)
File "/app/saleor/core/utils/random_data.py", line 276, in get_or_create_category
name=category_name, parent_id=parent_id, defaults=defaults)[0]
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 489, in get_or_create
return self._create_object_from_params(lookup, params)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 521, in _create_object_from_params
obj = self.create(params)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 417, in create
obj.save(force_insert=True, using=self.db)
File "/usr/local/lib/python3.6/site-packages/mptt/models.py", line 1009, in save
super(MPTTModel, self).save(args, *kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 729, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 759, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 842, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 880, 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 1125, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1284, in execute_sql
for sql, params in self.as_sql():
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1237, in as_sql
for obj in self.query.objs
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1237, in
for obj in self.query.objs
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1236, in
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1186, in pre_save_val
return field.pre_save(obj, add=True)
File "/usr/local/lib/python3.6/site-packages/versatileimagefield/fields.py", line 83, in pre_save
file = super(VersatileImageField, self).pre_save(model_instance, add)
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/files.py", line 287, in pre_save
file.save(file.name, file.file, save=False)
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/files.py", line 87, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 49, in save
return self._save(name, content)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 236, in _save
os.makedirs(directory)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
[Previous line repeated 1 more times]
File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/app/media'
Check permissions on media folder and maker sure it is not owned by root but by user you are running docker-compose. You may want to remove Saleor images (docker rmi $(docker images saleor_web -q)) and then build. Also make sure you did some post installation steps for docker.
https://docs.docker.com/install/linux/linux-postinstall/#configure-docker-to-start-on-boot
@akjanik it doesn't solve the issue with saleor.product.models.DoesNotExist: Category matching query does not exist.
It seems the docker installation process doesnt really work off the self.
@saikia1 I have the same issue as you did. Did you find a solution?
When I run 'docker-compose run web python3 manage.py collectstatic' I get the same file not found error as you. When I try the suggestion by @stephenmoloney, I know get:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, 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 288, in run_from_argv
self.execute(args, cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(args, *options)
File "/app/saleor/core/management/commands/populatedb.py", line 59, in handle
stdout=self.stdout)
File "/app/saleor/core/utils/random_data.py", line 238, in create_products_by_schema
how_many=how_many, create_images=create_images, stdout=stdout)
File "/app/saleor/core/utils/random_data.py", line 199, in create_products_by_type
category = get_or_create_category(schema['category'], placeholder_dir)
File "/app/saleor/core/utils/random_data.py", line 274, in get_or_create_category
name=category_name, parent_id=parent_id, defaults=defaults)[0]
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 489, in get_or_create
return self._create_object_from_params(lookup, params)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 521, in _create_object_from_params
obj = self.create(params)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 417, in create
obj.save(force_insert=True, using=self.db)
File "/usr/local/lib/python3.6/site-packages/mptt/models.py", line 1009, in save
super(MPTTModel, self).save(args, *kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 729, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 759, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 842, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 880, 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 1125, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1284, in execute_sql
for sql, params in self.as_sql():
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1237, in as_sql
for obj in self.query.objs
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1237, in
for obj in self.query.objs
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1236, in
[self.prepare_value(field, self.pre_save_val(field, obj)) for field in fields]
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1186, in pre_save_val
return field.pre_save(obj, add=True)
File "/usr/local/lib/python3.6/site-packages/versatileimagefield/fields.py", line 83, in pre_save
file = super(VersatileImageField, self).pre_save(model_instance, add)
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/files.py", line 287, in pre_save
file.save(file.name, file.file, save=False)
File "/usr/local/lib/python3.6/site-packages/django/db/models/fields/files.py", line 87, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 49, in save
return self._save(name, content)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 236, in _save
os.makedirs(directory)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
[Previous line repeated 1 more times]
File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/app/media'
On settings.py:
STATICFILES_DIRS = [
('assets', os.path.join(PROJECT_ROOT, 'saleor', 'static', 'assets'))
But there is no folder assets.... so the error assets not found.
This is the first issue when we follow your tutorial:
docker-compose run web python3 manage.py collectstatic
What is this of assets all about?
@miguelBarreiro85 thanks for your response.
I've had the issue of the installation complaining about a folder not found called 'assets'. Upon creating the folder myself I would then get a permission denied error. I even though it is a Ubuntu 14 issue but after updating to Ubuntu 16, I still got the issue so I posted the issue.
Um having the same problema, because the username os not correct. But if
you do the Run command with --user saleor ir wont give the permission
error. But it wont work either
A domingo, 16/09/2018, 20:29, EdwinNyamao notifications@github.com
escreveu:
@miguelBarreiro85 https://github.com/miguelBarreiro85 thanks for your
response.
I've had the issue of the installation complaining about a folder not
found called 'assets'. Upon creating the folder myself I would then get a
permission denied error. I even though it is a Ubuntu 14 issue but after
updating to Ubuntu 16, I still got the issue so I posted the issue.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/mirumee/saleor/issues/2642#issuecomment-421818160,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AYZmd4cbs6sh_VyjNLLyPCnXIZgFHtnDks5ubqaXgaJpZM4WEHHe
.
@Pacu2 thanks, I Was following the above docs
When I rundocker-compose run web python3 manage.py collectstaticI get the following errors
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/init.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/init.py", line 365, 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 288, in run_from_argv
self.execute(args, *cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(args, *options)
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 125, in list
for path in utils.get_files(storage, ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/saleor/static/assets'Also If i run
docker-compose run web python3 manage.py populatedb --createsuperuserPermissionError: [Errno 13] Permission denied: '/app/media'
I'm having the same issue, I just followed the docs. I have checked the dir owner and it all seems correct. Has anyone managed to solve it?
Docker version 18.06.1-ce, build e68fc7a
docker-compose version 1.22.0, build f46880fe
Linux insertname 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 GNU/Linux
I got same error. But I think I could find trick around.
I create two subdirectory saleor\static\assets and static in saleor dir. After it error dissapear.
For me it still is complaining of permission denied when I run collectstatic.
edwin@edwin-Aspire-5736Z:~/saleor$ docker-compose run web python3 manage.py collectstatic
Starting saleor-elasticsearch ... done
Starting saleor-postgres ... done
Starting saleor-redis ... done
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, 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 316, in run_from_argv
self.execute(args, *cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(args, *options)
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 188, in handle
collected = self.collect()
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 353, in copy_file
self.storage.save(prefixed_path, source_file)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 49, in save
return self._save(name, content)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 236, in _save
os.makedirs(directory)
File "/usr/local/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/local/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/app/static'
This should be resolved by #3091, if not, please reopen the issue.
I had same error,
you can try
docker-compose run app sh -c "python manage.py makemigrations or collectstatic <
@hardikzurdo hi! Please open an issue with the detailed errors.
Most helpful comment
@Pacu2 thanks, I Was following the above docs
When I run
docker-compose run web python3 manage.py collectstaticI get the following errors
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, 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 288, in run_from_argv
self.execute(args, *cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(args, *options)
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
for path, storage in finder.list(self.ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 125, in list
for path in utils.get_files(storage, ignore_patterns):
File "/usr/local/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
directories, files = storage.listdir(location)
File "/usr/local/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in listdir
for entry in os.listdir(path):
FileNotFoundError: [Errno 2] No such file or directory: '/app/saleor/static/assets'
Also If i run
docker-compose run web python3 manage.py populatedb --createsuperuserPermissionError: [Errno 13] Permission denied: '/app/media'