当我运行此命令时,我收到此错误:
$ heroku run python manage.py collectstatic
Running python manage.py collectstatic on myapp... up, run.1771
You have requested to collect static files at the destination location as specified in your settings:
/app/static_in_env/static_root
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel:
$ yes
OSError: [Errno 2] No such file or directory: '/app/my app/static_in_pro/our_static'
如何解决此问题?
我的静态文件设置
# Static asset configuration
STATIC_URL = '/static/'
STATIC_ROOT=os.path.join(os.path.dirname(BASE_DIR),"static_in_env","static_root")
STATICFILES_DIRS = ( os.path.join(BASE_DIR,"static_in_pro","our_static"),
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "static_in_env","media_root")
urls.py
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) –
答案 0 :(得分:0)
文件夹/app/my app/static_in_pro/our_static
不存在,如错误消息中所述:
OSError: [Errno 2] No such file or directory: '/app/my app/static_in_pro/our_static'
所以创建它和任何不存在的父目录,而不是重新运行命令。