Django 및 Heroku를 처음 사용합니다. 내 설치가 로컬로 잘 작동하지만 Heroku에 푸시되면 내 사이트의 CSS, js 또는 이미지를 볼 수 없습니다. heroku - django 이미지는 heroku에서 작동하지 않지만 로컬에서는 잘 작동합니다.
이
내 URL 패턴입니다 :urlpatterns = patterns('',
# Examples:
# url(r'^$', 'blog.views.home', name='home'),
# url(r'^blog/', include('blog.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^blog/', include('zinnia.urls')),
url(r'^', include('cms.urls')),
)
if settings.DEBUG:
urlpatterns = patterns('',
(r'^' + settings.MEDIA_URL.lstrip('/'), include('appmedia.urls')),
) + urlpatterns
그리고 이건 내 settings.py입니다 내가 잘못 가고 어디
STATIC_ROOT = os.path.join(PROJECT_PATH, "static")
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# 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.
)
은 알려 주시기 바랍니다. 미리 감사드립니다.
건배 당신의 DEBUG
설정이 Heroku가에 대한 True
로 설정되어
안녕하세요. Jason. 나는 이미 staticfiles 앱을 사용하고 있으며 로컬에서 collectstatic을 수행한다. 다시 말하지만, 이것은 로컬에서는 잘 작동하지만 Heroku에서는 작동하지 않습니다. – werty37
또한 이미지 URL을 확인하고 정적 폴더에서 제공하고 있습니다. 예 : "/static/cms/images/pony.jpg" – werty37
또 다른 흥미있는 발견. 로컬로도 이미지와 CSS는 장고 내장 서버와 NIT (gunicorn 또는 foreman 시작)에서만 제공됩니다. – werty37