1

我有一个 Django 应用程序,它在 Heroku 上部署了一个 React 前端。当我尝试进行更改然后运行

python ../manage.py collectstatic

它似乎在对无限量的文件进行后处理。它永远持续下去,直到它最终超时。

当我在开发模式下运行相同的命令时,一切正常。我不知道出了什么问题。文件是否被错误地带入?

这是完整的消息:

Post-processing 'All' failed!

Traceback (most recent call last):
  File "../manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
    collected = self.collect()
  File "/home/hzren/dev/t_and_b_website/venv/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 135, in collect
    raise processed
RuntimeError: Max post-process passes exceeded.

npm ERR! Linux 5.0.0-37-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "collectstatic"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! frontend-app@0.1.0 collectstatic: `python ../manage.py collectstatic --no-input`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frontend-app@0.1.0 collectstatic script 'python ../manage.py collectstatic --no-input'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the frontend-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     python ../manage.py collectstatic --no-input
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs frontend-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls frontend-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/hzren/github_workspace/tracy_and_brian_website/src/frontend-app/npm-debug.log

npm ERR! Linux 5.0.0-37-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "collect"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! frontend-app@0.1.0 collect: `react-scripts build && npm run build-rename && npm run copy-buildfiles && npm run collectstatic`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frontend-app@0.1.0 collect script 'react-scripts build && npm run build-rename && npm run copy-buildfiles && npm run collectstatic'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the frontend-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts build && npm run build-rename && npm run copy-buildfiles && npm run collectstatic
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs frontend-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls frontend-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:

以下是我的 settings.py 中的相关信息

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SETTINGS_PATH = os.path.dirname(os.path.dirname(__file__))


STATIC_URL = '/static/'

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'staticfiles'), 
]

STATIC_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'staticfiles')

STATICFILES_STORAGE = "django.contrib.staticfiles.storage.CachedStaticFilesStorage"


MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media_cdn')
MEDIA_URL = '/media_cdn/'

AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None

AWS_QUERYSTRING_AUTH = False

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

django_heroku.settings(locals())

提前非常感谢!

4

0 回答 0