Django - Strange behavior using static files

前端 未结 1 1795
眼角桃花
眼角桃花 2021-01-26 07:13

I\'m new to Django. I\'m getting insane trying to understand what is going on with static files(css\'s and images).

The resume of the problem is the following... when I

相关标签:
1条回答
  • 2021-01-26 07:50

    I don't know whether this will fix the issue, but your url patterns look a little confused. Each urlpatterns object should only have one prefix string as its first argument. You have 'haystack.views' and then later ''.

    You are passing callable objects instead of strings in your url patterns, so using the empty string '' for your prefix is fine.

    urlpatterns = patterns(
        '',                   
        url(r'^resultados/$', FacetedSearchView(template='emp1001br/pgresultados.html', searchqueryset=sqs, form_class=FacetedSearchForm), name='haystack_search'),                 
        (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), # To support static files
        url(r'^$', main_page),
        (r'^iframe/$', i_frame),
    )
    
    0 讨论(0)
提交回复
热议问题