Heroku Deployment - PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
Heroku Deployment - PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
谁能帮我解决这个错误?我不知道代码有什么问题。是数据库凭据错误吗?是应用程序代码错误吗?是 Linux/Unix 相关的错误吗?
这是我第一次在 Heroku 上部署我的应用程序,但我收到了这条错误消息:
PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
python ph_dorms/manage.py collectstatic --noinput
Traceback (most recent call last):
File "ph_dorms/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 353, in copy_file
with source_storage.open(path) as source_file:
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 33, in open
return self._open(name, mode)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 218, in _open
return File(open(self.path(name), mode))
PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
! Error while running '$ python ph_dorms/manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed
部署 django webapp 的复杂部分大部分时间都与 collectstatics 相关,前提是您没有正确设置所有内容以提供来自同一服务器的静态文件。
首先在您的终端或 cmd 中禁用 collectstatics 运行:
heroku config:set DISABLE_COLLECTSTATIC=1
然后再次部署。
您应该在 heroku 上禁用 collectstatic 并使用 whitenoise 在生产中提供静态文件。
运行 在你的 cmd 中(安装了 heroku cli)
heroku config:set DISABLE_COLLECTSTATIC = 1
或者将 DISABLE_COLLECTSTATIC 的值等于 1 添加到 heroku 中的环境变量。
然后,使用 whitenoise 在生产中提供静态文件。
谁能帮我解决这个错误?我不知道代码有什么问题。是数据库凭据错误吗?是应用程序代码错误吗?是 Linux/Unix 相关的错误吗?
这是我第一次在 Heroku 上部署我的应用程序,但我收到了这条错误消息:
PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
python ph_dorms/manage.py collectstatic --noinput
Traceback (most recent call last):
File "ph_dorms/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 353, in copy_file
with source_storage.open(path) as source_file:
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 33, in open
return self._open(name, mode)
File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 218, in _open
return File(open(self.path(name), mode))
PermissionError: [Errno 13] Permission denied: '/etc/passwd-'
! Error while running '$ python ph_dorms/manage.py collectstatic --noinput'.
See traceback above for details.
You may need to update application code to resolve this error.
Or, you can disable collectstatic for this application:
$ heroku config:set DISABLE_COLLECTSTATIC=1
https://devcenter.heroku.com/articles/django-assets
! Push rejected, failed to compile Python app.
! Push failed
部署 django webapp 的复杂部分大部分时间都与 collectstatics 相关,前提是您没有正确设置所有内容以提供来自同一服务器的静态文件。
首先在您的终端或 cmd 中禁用 collectstatics 运行:
heroku config:set DISABLE_COLLECTSTATIC=1
然后再次部署。
您应该在 heroku 上禁用 collectstatic 并使用 whitenoise 在生产中提供静态文件。
运行 在你的 cmd 中(安装了 heroku cli)
heroku config:set DISABLE_COLLECTSTATIC = 1
或者将 DISABLE_COLLECTSTATIC 的值等于 1 添加到 heroku 中的环境变量。
然后,使用 whitenoise 在生产中提供静态文件。