我之前已經做過collectstatic,而且進展順利。現在我嘗試將應用程式部署到 Heroku,并得到了錯誤。它也在本地復制。
OSError:[Errno 63] 檔案名太長:'/Users/admin/Desktop/Programming/Python/UkranianFunds/src/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles /app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app /staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles /app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app /staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/app/staticfiles/db.sqlite3'
這是我的專案結構:
![OSError: [Errno 63] File name too long: db.sqlite3 when doing collectstatic on django](https://i.stack.imgur.com/MLpQp.png)
如果這很重要,我在 gitignore 中有我的 db.sqlite3。
這是我的設定:
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATICFILES_DIRS = [
os.path.join(BASE_DIR), 'static'
]
我的 db.sqlite 檔案位于 src 目錄中。不清楚為什么 collectstatic 添加所有這些子檔案夾。
uj5u.com熱心網友回復:
解決方案很簡單——我剛剛洗掉了我的 staticfiles 檔案夾,并再次制作了 collectstatic——而且效果很好。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/524072.html
上一篇:我應該在Heroku-dev&prod上為Django使用兩個Postgres資料庫嗎?
下一篇:添加列Heroku資料庫
