python - Django static files not working on Heroku -


my django application working on local server. but, when deploy on heroku, static files not being served (getting 404 error). please help!

from django.conf.urls import patterns, include, url django.contrib import admin django.conf.urls.static import static django.conf import settings  urlpatterns = patterns('',        url(r'^$', 'product.views.home', name='home'),        url(r'^admin/', include(admin.site.urls)),     ) if settings.debug:        urlpatterns += static(settings.static_url,document_root=settings.static_root)        urlpatterns += static(settings.media_url, document_root=settings.media_root) 

static files settings:

  template_dirs = (       os.path.join(base_dir, 'templates'),   )    static_url = '/static/'    media_url = '/media/'    media_root = os.path.join(base_dir, "static", "media")    static_root = os.path.join(base_dir, "static", "static_root")    staticfiles_dirs = (       os.path.join(base_dir, "static", "static_dirs"),   ) 

wsgi file -

  import os   os.environ.setdefault("django_settings_module", "acton.settings")    django.core.wsgi import get_wsgi_application   application = get_wsgi_application()    try:       dj_static import cling       application = cling(get_wsgi_application())    except:       pass 


setting static files deploy on heroku.

hope :

import os
base_dir = os.path.dirname(os.path.abspath(file))
static_root = 'staticfiles'
static_url ='/static/'
media_root = os.path.join(project_path, "media")
media_url = "/media/"
staticfiles_dirs = (
os.path.join(base_dir, 'static'),
)


Comments

Popular posts from this blog

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -