Heroku 尝试部署 python 网站 ,manage.py collestatic --noninput"
Heroku try to deploy python website ,,manage.py collestatic --noninput"
我使用 Python ,JS, React, Django 创建了一个网站。当我通过 github 在 Heroku 上部署时,出现错误:
-----> Determining which buildpack to use for this app
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: Python,Node.js
See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Python app detected
-----> Using Python version specified in Pipfile.lock
cp: cannot stat '/tmp/build_02d1f320/requirements.txt': No such file or directory
-----> Installing python-3.9.7
-----> Installing pip 20.2.4, setuptools 57.5.0 and wheel 0.37.0
-----> Installing dependencies with Pipenv 2020.11.15
Installing dependencies from Pipfile.lock (dee4f1)...
-----> Installing SQLite3
-----> $ python leadmanager/manage.py collectstatic --noinput
Traceback (most recent call last):
File "/tmp/build_02d1f320/leadmanager/manage.py", line 22, in <module>
main()
File "/tmp/build_02d1f320/leadmanager/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 338, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 248, in delete_file
if self.storage.exists(prefixed_path):
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/files/storage.py", line 318, in exists
return os.path.exists(self.path(name))
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 38, in path
raise ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
! Error while running '$ python leadmanager/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
这是我的 github 存储库:enter link description here
当我尝试通过 localhost:8000 运行 我的网站时,它运行良好,但现在,当我尝试在 Heroku 上部署时,出现此错误。我的数据库是使用 django 构建的。
请帮助我,thx!!
来自错误回溯 STATIC_ROOT
url 未配置。
您需要在您的 django 应用 settings.py
脚本中配置静态文件目录 url,例如:STATIC_ROOT = BASE_DIR + "../your-static-dir"
之后你可以在 Heroku 上添加 运行 收集静态命令
heroku run python manage.py collectstatic --dry-run --noinput
还可以考虑检查此问题的陈述,以获取有关配置静态和媒体 url 的更多信息。
我使用 Python ,JS, React, Django 创建了一个网站。当我通过 github 在 Heroku 上部署时,出现错误:
-----> Determining which buildpack to use for this app
! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
Detected buildpacks: Python,Node.js
See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Python app detected
-----> Using Python version specified in Pipfile.lock
cp: cannot stat '/tmp/build_02d1f320/requirements.txt': No such file or directory
-----> Installing python-3.9.7
-----> Installing pip 20.2.4, setuptools 57.5.0 and wheel 0.37.0
-----> Installing dependencies with Pipenv 2020.11.15
Installing dependencies from Pipfile.lock (dee4f1)...
-----> Installing SQLite3
-----> $ python leadmanager/manage.py collectstatic --noinput
Traceback (most recent call last):
File "/tmp/build_02d1f320/leadmanager/manage.py", line 22, in <module>
main()
File "/tmp/build_02d1f320/leadmanager/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
collected = self.collect()
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
handler(path, prefixed_path, storage)
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 338, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 248, in delete_file
if self.storage.exists(prefixed_path):
File "/app/.heroku/python/lib/python3.9/site-packages/django/core/files/storage.py", line 318, in exists
return os.path.exists(self.path(name))
File "/app/.heroku/python/lib/python3.9/site-packages/django/contrib/staticfiles/storage.py", line 38, in path
raise ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
! Error while running '$ python leadmanager/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
这是我的 github 存储库:enter link description here
当我尝试通过 localhost:8000 运行 我的网站时,它运行良好,但现在,当我尝试在 Heroku 上部署时,出现此错误。我的数据库是使用 django 构建的。 请帮助我,thx!!
来自错误回溯 STATIC_ROOT
url 未配置。
您需要在您的 django 应用 settings.py
脚本中配置静态文件目录 url,例如:STATIC_ROOT = BASE_DIR + "../your-static-dir"
之后你可以在 Heroku 上添加 运行 收集静态命令
heroku run python manage.py collectstatic --dry-run --noinput
还可以考虑检查此问题的陈述,以获取有关配置静态和媒体 url 的更多信息。