I am getting PermissionError: [Errno 13] Permission denied:
while I am running collectstatic
command.
Previously I was used s3 for static files, but I don't want to use that. I was switching back to Django's Native static handler. I reverted the settings and removed STATICFILES_STORAGE
. But now I started getting PermissionError
.
I even changed static
folders permissions to 777
but that didn't help.
I tried creating a new project But in that project, collectstatic command is working fine.
I also took a clone of the same project at 2 different locations on my system but it was also not working.
The static folder owner is also correct.
drwxr-xr-x 6 rohit.chopra domain users 4096 Jul 4 13:24 static/
drwxr-xr-x 2 rohit.chopra domain users 4096 Jul 4 13:22 templates/
Setting.py
# STATICFILES_DIRS = [
# os.path.join(BASE_DIR, 'static'),
# ]
# STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
# STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
DEFAULT_FILE_STORAGE = 'medicine.storage_backends.MediaStorage'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
# MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
Traceback
Type 'yes' to continue, or 'no' to cancel: yes
Copying '/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/contrib/admin/static/admin/img/icon-yes.svg'
2020-07-04 13:51:30,064 - [bugsnag] WARNING - No API key configured, couldn't notify
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 199, in handle
collected = self.collect()
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 124, in collect
handler(path, prefixed_path, storage)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 364, in copy_file
self.storage.save(prefixed_path, source_file)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/files/storage.py", line 54, in save
return self._save(name, content)
File "/home/rohit.chopra/virtualenvs/medicine/lib/python3.6/site-packages/django/core/files/storage.py", line 317, in _save
os.makedirs(directory, self.directory_permissions_mode)
File "/usr/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/home/rohit.chopra/projects/medicine/static/admin/img'
I have commented the previous settings.
Can you guys please help me resolve this issue.