Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么Python无法构建?_Python_Django_Heroku - Fatal编程技术网

为什么Python无法构建?

为什么Python无法构建?,python,django,heroku,Python,Django,Heroku,我在Heroku上运行了一个Python/Django项目,当我推动主分支使其自动构建时,我得到了以下结果: -----> Python app detected -----> Installing requirements with pip $ python manage.py collectstatic --noinput /app/.heroku/python/lib/python2.7/site-packages/dotenv/main.py:24: UserWarn

我在Heroku上运行了一个Python/Django项目,当我推动主分支使其自动构建时,我得到了以下结果:

-----> Python app detected
-----> Installing requirements with pip
 $ python manage.py collectstatic --noinput
   /app/.heroku/python/lib/python2.7/site-packages/dotenv/main.py:24: UserWarning: Not loading /tmp/build_c2832b0dda7d9e04b969788b6541eb9e/BTCMedia-distributed-7754c155736b5d0a1512d1cd22cae8af4ff8451d/genesis/settings/.env - it doesn't exist.
     warnings.warn("Not loading %s - it doesn't exist." % dotenv_path)
   Traceback (most recent call last):
     File "manage.py", line 11, in <module>
       execute_from_command_line(sys.argv)
     File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
       utility.execute()
     File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
       self.fetch_command(subcommand).run_from_argv(self.argv)
     File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
       self.execute(*args, **cmd_options)
     File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
       output = self.handle(*args, **options)
     File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 193, in handle
       collected = self.collect()
     File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 115, in collect
       for path, storage in finder.list(self.ignore_patterns):
     File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
       for path in utils.get_files(storage, ignore_patterns):
     File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
       directories, files = storage.listdir(location)
     File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 399, in listdir
       for entry in os.listdir(path):
   OSError: [Errno 2] No such file or directory: '/tmp/build_c2832b0dda7d9e04b969788b6541eb9e/BTCMedia-distributed-7754c155736b5d0a1512d1cd22cae8af4ff8451d/build/css'
   !     Error while running '$ python 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
我注意到,在成功的建筑中,它是这样写的

-----> Node.js app detected
那就去跑步吧

  -----> Build succeeded!
  -----> Python app detected
运行更多的东西

但是,在失败的构建中,它直接“跳过”到检测到的Python应用程序

这有什么线索吗?
知道问题可能是什么吗?

答案似乎就在您提供的输出的底部:

https://devcenter.heroku.com/articles/django-assets

该页面将为您提供示例设置,您可以使用这些设置使
collectstatic
工作。

使用
heroku buildpacks
检查buildpacks(如果您有多个远程应用程序用于该回购,请使用
-a[app name]
标志)。如果您没有看到Node.js buildpack,那么您需要添加它:
heroku buildpacks:add heroku/nodejs
https://devcenter.heroku.com/articles/django-assets