我想在heroku上運行collectstatic。當我得到這個錯誤:Django Collectstatic可疑文件操作
remote: 'component ({})'.format(final_path, base_path))
remote: django.core.exceptions.SuspiciousFileOperation: The joined path (/tmp/build_4652acfe079723bc273763513a187201/fonts/glyphicons-halflings-regular.eot) is located outside of the base path component (/tmp/build_4652acfe079723bc273763513a187201/staticfiles)
我想也許我已經錯過了與collectstatic我最終的東西,所以我跑在本地,並得到了確切的同樣的錯誤。
然後我看了看。我發現:
/home/malikarumi/Projects/aishah/jamf35/staticfiles/bootstrap/fonts/glyphicons-halflings-regular.eot
和
/家庭/ malikarumi /項目/ aishah/jamf35 /static/bootstrap/fonts/glyphicons-halflings-regular.eot
我的設置:
STATICFILES_DIRS = [ os.path.join(BASE_DIR, '靜止/引導/字體/'),
這裏有一張票,但它似乎是關於路徑,我看到我的路徑沒有錯,https://code.djangoproject.com/ticket/27201 另一個處理文件,可能更接近我的問題,因爲它必須與創建TMP文件,但我實在看不出來: https://code.djangoproject.com/ticket/26644
我要指出,我還看了Django: The joined path is located outside of the base path component, Django: How to allow a Suspicious File Operation/copy a file和Django | joined path is located outside of the base path component {% static img.thumbnail.url %}, Error 400 with whitenoise,但他們似乎更有關媒體ROOT的問題。
我不確定修復程序是什麼,在這裏。請指教。謝謝。
丁丁,你拿獎了。實際上,我只發佈了一個我認爲存在問題的靜態文件目錄,但是我爲每個子目錄都有一個路徑,並且它們中的任何一個都應該在那裏,並且它們不應該有os.path。我把它們拿出來,它工作正常。 os.path連接僅用於定義「靜態」。當我這樣設置時,我不知道我在想什麼,我一定是喝醉了。謝謝。 –