根据这篇文章https://devcenter.heroku.com/articles/django-assets
希罗库应该打电话来
python manage.py collectstatic
在我用这个django_herokuhttps://devcenter.heroku.com/articles/django-app-configuration配置设置之后
我的配置变量:
DEBUG_COLLECTSTATIC: 1
DISABLE_COLLECTSTATIC: 0
我的构建包:heroku/python
我将此代码放在settings.py的最后一行
import django_heroku
# Activate Django-Heroku.
django_heroku.settings(locals())
我的文件夹是这样的
apps
|---apps
|---settings
|---base.py
|---settings.py
这是我的构建日志
-----> Python app detected
! Python has released a security update! Please consider upgrading to python-3.7.7
Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Found python-3.7.7, removing
-----> No change in requirements detected, installing from cache
-----> Installing python-3.7.6
-----> Installing pip
-----> Installing SQLite3
-----> Installing requirements with pip
Collecting asgiref==3.2.7
Downloading asgiref-3.2.7-py2.py3-none-any.whl (19 kB)
Collecting dj-database-url==0.5.0
Downloading dj_database_url-0.5.0-py2.py3-none-any.whl (5.5 kB)
Collecting Django==3.0.6
Downloading Django-3.0.6-py3-none-any.whl (7.5 MB)
Collecting django-heroku==0.3.1
Downloading django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
Collecting gunicorn==20.0.4
Downloading gunicorn-20.0.4-py2.py3-none-any.whl (77 kB)
Collecting psycopg2==2.7.5
Downloading psycopg2-2.7.5-cp37-cp37m-manylinux1_x86_64.whl (2.7 MB)
Collecting psycopg2-binary==2.8.5
Downloading psycopg2_binary-2.8.5-cp37-cp37m-manylinux1_x86_64.whl (2.9 MB)
Collecting pytz==2020.1
Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse==0.3.1
Downloading sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
Collecting whitenoise==5.1.0
Downloading whitenoise-5.1.0-py2.py3-none-any.whl (19 kB)
Installing collected packages: asgiref, dj-database-url, sqlparse, pytz, Django, whitenoise, psycopg2, django-heroku, gunicorn, psycopg2-binary
Successfully installed Django-3.0.6 asgiref-3.2.7 dj-database-url-0.5.0 django-heroku-0.3.1 gunicorn-20.0.4 psycopg2-2.7.5 psycopg2-binary-2.8.5 pytz-2020.1 sqlparse-0.3.1 whitenoise-5.1.0
-----> Discovering process types
Procfile declares types -> release, web
-----> Compressing...
Done: 58.8M
-----> Launching...
! Release command declared: this new release will not be available until the command succeeds.
我还尝试在procfile上添加run python manage.py collectstatic,就像建议的那样,但它不运行Heroku performing collectstatic as expected on deployment?
尝试通过heroku的bash手动运行它,它很好,运行良好
有人知道为什么heroku不打电话给collectstatic吗
我已经找到了根本原因
我想这是因为我有这些配置变量
在我删除那些配置变量之后,它就可以工作了
相关问题 更多 >
编程相关推荐