Improperly Configured URLConfs/URL Patterns

514 views
Skip to first unread message

Gaurav Wadhwani

unread,
Jun 18, 2015, 12:48:05 AM6/18/15
to django...@googlegroups.com
Hi,

I am trying to customise the catalogue and reviews app in Django-Oscar. As a result, I needed a new model, view and url in the reviews app - which led me to customise the app.py files in both catalogue and reviews app.

And now, I think I've wrecked the entire url structure of the system. Nothing seems to work and the error I get is:

The included urlconf '<bound method Shop.get_urls of <oscar.app.Shop object at 0x10d463ad0>>' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.

I also removed the new app.py files from both catalogue and reviews app but it still doesn't seem to work.

For consideration, the contents of the file are below:

catalogue/app.py

__author__ = 'GauravWadhwani'

from oscar.apps.catalogue import app
from m3_oscar.catalogue.reviews.app import application as reviews_app
from oscar.core.application import Application

class CustomReviewsApplication(Application):
 name
= None
 reviews_app
= reviews_app

 
def get_urls(self):
 urlpatterns
= super(CustomReviewsApplication, self).get_urls
 urlpatterns
+= [
 url
(r'^(?P<product_slug>[\w-]*)_(?P<product_pk>\d+)/reviews/',
 include
(self.reviews_app.urls)),
 
]
 
return self.post_process_urls(urlpatterns)


class CustomCatalogueApplication(app.CatalogueApplication, CustomReviewsApplication):
 
"""
 Composite class combining Products with Reviews
 """


application
= CustomCatalogueApplication
 
catalogue/reviews/app.py

__author__ = 'GauravWadhwani'

from django.conf.urls import url
from django.contrib.auth.decorators import login_required

from oscar.core.loading import get_class

from oscar.apps.catalogue.reviews.app import ProductReviewsApplication as BaseApplication


class CustomProductReviewsApplication(BaseApplication):

 add_star_view
= get_class('catalogue.reviews.views', 'AddStarView')

 
def get_urls(self):
 urls
= [
 url
(r'^star/$',
 login_required
(self.add_star_view.as_view()),
 name
='reviews-star'),
 
]
 
return self.post_process_urls(urls)


application
= CustomProductReviewsApplication()

Again: I have removed the app.py files and tried as well (that way it was working before) but now it doesn't work anymore.
What may be wrong here?

Gaurav Wadhwani

unread,
Jun 18, 2015, 7:25:34 AM6/18/15
to django...@googlegroups.com
I just reverted back to my last working commit and the project still doesn't work. Upon further investigation, it appears that the URLs from app.py file of Oscar aren't loading. It is simply returning None Object data.

How do I fix this?
Reply all
Reply to author
Forward
0 new messages