NoReverseMatch for 'satchmo_brand_list' when DEBUG False (satchmo_ext.brand problem)

22 views
Skip to first unread message

Marconius Cuthemustard

unread,
Aug 10, 2012, 11:49:52 AM8/10/12
to satchm...@googlegroups.com
<del>I'm having lots of trouble with a problem and I am hoping someone has already encountered it and can help me with</del>. I have encountered some weird behaviour that I thought I should share in case anyone gets the same problem or perhaps I have stumbled on a bug. I fixed it in my local urlconf with a quick workaround as I don't have time to look into it further right now, but I think the problem is related to the way the urlpatterns are automatically added to the project in the brand module.

The problem only occurs when DEBUG = False. Everything works fine when running with DEBUG = True. Even in the python shell (with DEBUG = False) everything seems to work fine:

>>> from django.core.urlresolvers import reverse

>>> reverse('satchmo_brand_list')
'/brand/'

What's even more confusing is that the site works fine with DEBUG=False when using ./manage.py runserver. Otherwise, with uWsgi and gunicorn, I get the NoReverseMatch err.

#urls.py (excerpt)

from satchmo_store.urls import urlpatterns
from satchmo_utils.urlhelper import replace_urlpattern
from localsite.views import HomeView

# ... other code

urlpatterns += patterns('',
    url(r'^$', HomeView.as_view(), name='soxbox_home'),
)

# ... patterns from other apps   

replacement = url(r'^(?P<brandname>.*)/$', 'localsite.views.brand_page', {},
                  'satchmo_brand_view')
replace_urlpattern(urlpatterns, replacement)
replacement = url(r'^(?P<parent_slugs>([-\w]+/)*)?(?P<slug>[-\w]+)/$',
                  'localsite.views.category_view', name='satchmo_category')
replace_urlpattern(urlpatterns, replacement)

To work around the problem for now, I just included the brand urls manually: `url(r'^brand/', include('satchmo_ext.brand.urls'))` in my urlconf.
Reply all
Reply to author
Forward
0 new messages