gpt4 book ai didi

heroku - Django admin static css not found with heroku foreman start local...但推送远程没问题

转载 作者:行者123 更新时间:2023-12-02 17:29:02 36 4
gpt4 key购买 nike

当我在本地运行foreman start时 - 我没有从静态加载管理CSS...

但是当它被推到远程时,它一切都按预期工作!哦。

我希望我的本地工头模仿我的远程实例...

这是我当前的静态内容的settings.py:(有人可以帮忙吗?)

STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static'

# Additional locations of static files
STATICFILES_DIRS = (
os.path.join(PROJECT_DIR, 'static'),
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

最佳答案

尝试修改您的 STATIC_ROOT 以假设为 project_path/static/并运行

python manage.py collectstatic

Heroku 自动运行collectstatic(如果一切设置正确):)

希望对你有帮助!

关于heroku - Django admin static css not found with heroku foreman start local...但推送远程没问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12771996/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com