g-Heroku-部署期间收集静电和WhiteNoise

时间:2018-09-09 20:52:05

标签: python django heroku wagtail

我正在关注https://wagtail.io/blog/wagtail-heroku-2017/

中的新教程

但是我在使用collectstatic和白噪声程序包时遇到了麻烦

remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing requirements with pip
remote: 
remote: -----> $ python manage.py collectstatic --noinput
remote:        Traceback (most recent call last):
remote:          File "manage.py", line 10, in <module>
remote:            execute_from_command_line(sys.argv)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
remote:            utility.execute()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 365, in execute
remote:            self.fetch_command(subcommand).run_from_argv(self.argv)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 288, in run_from_argv
remote:            self.execute(*args, **cmd_options)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 335, in execute
remote:            output = self.handle(*args, **options)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 189, in handle
remote:            collected = self.collect()
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 105, in collect
remote:            for path, storage in finder.list(self.ignore_patterns):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/finders.py", line 125, in list
remote:            for path in utils.get_files(storage, ignore_patterns):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
remote:            directories, files = storage.listdir(location)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 313, in listdir
remote:            for entry in os.listdir(path):
remote:        FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_4d889a5985b9c262c637b03bd07e9098/hello/static'
remote: 
remote:  !     Error while running '$ python manage.py collectstatic --noinput'.
remote:        See traceback above for details.
remote: 
remote:        You may need to update application code to resolve this error.
remote:        Or, you can disable collectstatic for this application:
remote: 
remote:           $ heroku config:set DISABLE_COLLECTSTATIC=1
remote: 
remote:        https://devcenter.heroku.com/articles/django-assets

我使用了heroku config:set DISABLE_COLLECTSTATIC=1

但这没什么大不了的,因为对于wagtail管理门户而言,它没有任何资产...并且不可能使用它。我很失望。

我尝试使用白噪声程序包,但是有一个新版本4.0进行了新更改:

http://whitenoise.evans.io/en/stable/changelog.html#v4-0

即使进行了此更改,我也出现了内部服务器错误。 (带有新的更改日志)

如果使用本教程中的旧设置会导致崩溃。

(test) Charless-MBP:hello charles$ python manage.py collectstatic
Copying '/Users/charles/test/hello/hello/static/css/hello.css'
Copying '/Users/charles/test/hello/hello/static/js/hello.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/embeds/static/wagtailembeds/js/embed-chooser-modal.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/embeds/static/wagtailembeds/js/hallo-plugins/hallo-wagtailembeds.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/users/static/wagtailusers/css/groups_edit.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/users/static/wagtailusers/js/group-form.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/snippets/static/wagtailsnippets/js/snippet-chooser.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/snippets/static/wagtailsnippets/js/snippet-chooser-modal.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/snippets/static/wagtailsnippets/js/snippet-multiple-select.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/documents/static/wagtaildocs/css/add-multiple.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/documents/static/wagtaildocs/js/document-chooser-modal.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/documents/static/wagtaildocs/js/document-chooser.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/documents/static/wagtaildocs/js/add-multiple.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/documents/static/wagtaildocs/js/hallo-plugins/hallo-wagtaildoclink.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/css/focal-point-chooser.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/css/add-multiple.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/css/vendor/jquery.Jcrop.min.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/css/vendor/Jcrop.gif'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/image-url-generator.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/image-chooser-modal.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/image-chooser.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/focal-point-chooser.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/add-multiple.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/hallo-plugins/hallo-wagtailimage.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/vendor/load-image.min.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/vendor/jquery.fileupload-validate.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/vendor/canvas-to-blob.min.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/vendor/jquery.Jcrop.min.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/images/static/wagtailimages/js/vendor/jquery.fileupload-image.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/search/static/wagtailsearch/js/query-chooser-modal.js'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/admin/static/wagtailadmin/css/core.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/admin/static/wagtailadmin/css/normalize.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/wagtail/admin/static/wagtailadmin/css/userbar.css'
Copying '/Users/charles/test/lib/python3.6/site-packages/django/contrib/admin/static/admin/fonts/Roboto-Bold-webfont.woff'
Copying '/Users/charles/test/lib/python3.6/site-packages/django/contrib/admin/static/admin/fonts/Roboto-Regular-webfont.woff'
Copying '/Users/charles/test/lib/python3.6/site-packages/django/contrib/admin/static/admin/fonts/README.txt'
Copying '/Users/charles/test/lib/python3.6/site-packages/django/contrib/admin/static/admin/fonts/LICENSE.txt'

264 static files copied to '/Users/charles/test/hello/static'.

base.py:

from .base import *

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '%342u%f#56t6!iw4t+4st8$5j%8d51-7=tf#3#zk2=b&g%jnw^'

# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*'] 

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


try:
    from .local import *
except ImportError:
    pass

enter image description here

0 个答案:

没有答案