按教程将项目推送到heroku,前面步骤一切顺利没有任何错误,直到这里出现问题在网上没有找到解决方法。。。
感觉好像是setting.py的设置有问题,但和教程里对照是一样的:
if os.getcwd()=='/app':
import dj_database_url
DATABASES={
'default':dj_database_url.config(default='postgres://localhost')
}
SECURY_PROXY_SSL_HEADER=('HTTP_X_FORWARDED_PROTO','https')
ALLOWED_HOSTS = ['*']
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
命令行的报错:
(ll_env) G:python_dorest>heroku create
Creating app... done, protected-crag-1803
https://protected-crag-1803.h... | https://git.heroku.com/protec...
(ll_env) G:python_dorest>git push heroku master
Counting objects: 48, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (39/39), done.
Writing objects: 100% (48/48), 11.18 KiB | 0 bytes/s, done.
Total 48 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.5.2
—————————中间内容省略—————————
remote:为 django-bootstrap3 运行 setup.py install:开始
remote:为 django-bootstrap3 运行 setup.py install:完成状态“done”
remote:成功安装 Django-1.11.2 dj -database-url-0.4.2 dj-static-0.0.6 django-bootstrap3-8.2.3 Gunicorn-19.7.1 psycopg2-2.7.1 pytz-2017.2 static3-0.7.0
remote:
remote: -----> $ python manage.pycollectstatic--noinput
remote:回溯(最近一次调用最后一次):
remote:文件“manage.py”,第22行,在<模块>
remote中:execute_from_command_line(sys .argv)
remote:文件“/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py”,第363行,在execute_from_command_line
remote:实用程序.execute()
remote:文件“/app/.heroku/python/lib/python3.5/site-packages/django/core/management/__init__.py”,第355行,在execute
remote中: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: 文件“/app/.heroku/python/lib/python3.5/site-packages/django/core/management/base.py”,行283,在 run_from_argv
remote 中:self.execute(args, *cmd_options)
remote: 文件“/app/.heroku/python/lib/python3.5/site-packages/django /core/management/base.py”,第 330 行,在执行
remote: 输出 = self.handle(args, *options)
remote: 文件“/app/.heroku/ python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py”,第 199 行,句柄
remote:collected = self.collect()
remote:文件“/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py”,第 124 行,在collect
remote: handler(path, prefixed_path,存储)
remote:文件“/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py”,第354行,在copy_file
中远程:如果不是 self.delete_file(path, prefixed_path, source_storage):
remote: File "/app/.heroku/python/lib/python3.5/site-packages/django/contrib/staticfiles/management/commands/ collectstatic.py”,第 260 行,delete_file
remote: if self.storage.exists(prefixed_path):
remote: File “/app/.heroku/python/lib/python3.5/site-packages/ django/core/files/storage.py",第 392 行,存在
remote: return os.path.exists(self.path(name))
remote: File "/app/.heroku/python/ lib/python3.5/site-packages/django/contrib/staticfiles/storage.py",第 50 行,路径
remote: raise ImproperlyConfigured("您正在使用 staticfiles 应用程序 "
remote: django. core.exceptions.ImproperlyConfigured:您正在使用 staticfiles 应用程序,而没有将 STATIC_ROOT 设置设置为文件系统路径。
remote:
remote:! 运行“$ python manage.pycollectstatic--noinput”时出错。
远程:有关详细信息,请参阅上面的回溯。
远程:
远程:您可能需要更新应用程序代码来解决此错误。
远程:或者,您可以为此应用程序禁用collectstatic:
远程:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/...
remote: ! 推送被拒绝,无法编译 Python 应用程序。
remote:
remote: ! 推送失败
远程:正在验证部署...
远程:
远程:! 推送到 protected-crag-1803 被拒绝。
remote:
To https://git.heroku.com/protec...
! [远程拒绝]master-> master(预接收挂钩被拒绝)
错误:无法将一些引用推送到“https://git.heroku.com/protec...”
好好看错误日志啊: