我在Heroku上有一个Django应用程序.我对静态文件有一些问题(它们在一个Heroku environment中加载,而不是另一个),所以我try 了debug命令建议的here.
$ heroku run python manage.py collectstatic --noinput
Running `python manage.py collectstatic --noinput` attached to terminal... up, run.8771
OSError: [Errno 2] No such file or directory: '/app/{myappname}/static'
下面是我的settings.py,这也是Heroku推荐的:
import os
import os.path
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
无论我的Git repo中是否真的在根级别有一个目录"静电",我都会收到这个错误(这两种方法都进行了测试).
有什么 idea 吗?