當我運行這個命令我得到這個錯誤:Heroku的執行python manage.py collectstatic
$ 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'
我怎樣才能解決這個問題呢?
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) –
請顯示您的靜態文件設置。 –
這是我staticfiles #靜態的資產配置 STATIC_URL = '/靜態/' 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」), #os.path.join(BASE_DIR, 'static_in_env'), ) MEDIA_URL = '/媒體/' MEDIA_ROOT = OS。 path.join(os.path.dirname(BASE_DIR),「static_in_env」,「media_root」) urls.py if settings.DEBUG: \t urlpatterns + = static(settings.STATIC_ URL,document_root = settings.STATIC_ROOT) \t urlpatterns + = static(settings.MEDIA_URL,document_root = settings.MEDIA_ROOT) –
我試圖自己做,但意識到我不得不猜測,因爲格式丟失,所以請改爲:請編輯您的問題以包含您的設置。 (另外,包括你的WSGI;你是否在使用Heroku Django快速啓動建議?) – Foon