1.在Heroku上部署app出现如下错误:
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
2.原因:
Heroku通过您的应用程序根目录中的两个文件之一来知道您的应用程序是一个Python应用程序:
Pipfile
requirements.txt
如果其中一个文件不在您的存储库的根目录中,那么Python buildpack将无法检测到您的应用程序
解决:
配置Pipfile文件和requiments.txt文件
Pipfile文件:
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
[packages]
django = "*"
gunicorn = "*"
[requires]
python_version = "3.6"
requirements文件:
dj-database-url==0.5.0
dj-static==0.0.6
Django==2.0.2
django-bootstrap3==9.1.0
gunicorn==19.7.1
psycopg2>=2.7.4
static3==0.7.0