每当我键入命令:fetchPages { viewControllers in
if let viewControllers = viewControllers { // if you don't want to change controllers if there was any error
self.orderedViewControllers = viewControllers
... // moment when you have `orderedViewControllers`
}
}
git push heroku master
此处给出错误
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 4 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (32/32), 11.43 KiB | 557.00 KiB/s, done.
Total 32 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.7
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting dj-database-url==0.5.0 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
remote: Collecting Django==2.1.3 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/d1/e5/2676be45ea49cfd09a663f289376b3888accd57ff06c953297bfdee1fb08/Django-2.1.3-py3-none-any.whl (7.3MB)
remote: Collecting django-heroku==0.3.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
remote: Collecting gunicorn==19.9.0 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 4))
remote: Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote: Collecting psycopg2==2.7.6.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 5))
remote: Downloading https://files.pythonhosted.org/packages/bc/2a/61a8f9719bd6df5b421abd91740cb0595fc3c17b28eaf89fe4f144472ca6/psycopg2-2.7.6.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
remote: Collecting pytz==2018.7 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 6))
remote: Downloading https://files.pythonhosted.org/packages/f8/0e/2365ddc010afb3d79147f1dd544e5ee24bf4ece58ab99b16fbb465ce6dc0/pytz-2018.7-py2.py3-none-any.whl (506kB)
remote: Collecting whitenoise==4.1.2 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 7))
remote: Downloading https://files.pythonhosted.org/packages/fd/2a/b51377ab9826f0551da19951257d2434f46329cd6cfdf9592ea9ca5f6034/whitenoise-4.1.2-py2.py3-none-any.whl
remote: Installing collected packages: dj-database-url, pytz, Django, whitenoise, psycopg2, django-heroku, gunicorn
remote: Successfully installed Django-2.1.3 dj-database-url-0.5.0 django-heroku-0.3.1 gunicorn-19.9.0 psycopg2-2.7.6.1 pytz-2018.7 whitenoise-4.1.2
python版本:3.6.7
django版本:2.1.3
heroku版本:0.1.4
git版本:2.20.1.windows.1
机器:窗口10
我没有任何静态文件,它是一个简单的 Hello,World 应用
我键入的命令:
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 15, 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 381, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, 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 316, 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 353, 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 188, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
remote: handler(path, prefixed_path, storage)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 343, in copy_file
remote: if not self.delete_file(path, prefixed_path, source_storage):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 249, in delete_file
remote: if self.storage.exists(prefixed_path):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 308, in exists
remote: return os.path.exists(self.path(name))
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 43, in path
remote: raise ImproperlyConfigured("You're using the staticfiles app "
remote: django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
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
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to arshergon.
remote:
To https://git.heroku.com/arshergon.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/arshergon.git'
答案 0 :(得分:2)
尝试
heroku config:set DISABLE_COLLECTSTATIC=1
答案 1 :(得分:1)
之前:发生错误时
.box
我们可以看到,回溯状态
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 23, 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 316, in listdir
remote: for entry in os.scandir(path):
remote: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'
。
这是因为我的静态文件为FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'
,而我的 STATICFILES_DIR 没有指向该目录。所以我唯一要做的就是
root/home/static
而不是通常的STATICFILES_DIRS = [
os.path.join(BASE_DIR, "home", "static"),
]
。
如果您只是尝试不使用任何静态文件,则可以直接使用os.path.join(BASE_DIR, "static")
然后进行推送。
答案 2 :(得分:0)
即使您没有静态文件,Django Hello World app也会提及它们。
请检查是否可以声明STATIC_ROOT
您的设置。py:
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
(原为done in here)