3👍
✅
Expanding on c.grey’s answer to specify how to replace instead of add the urls –
from django.conf.urls import url, include
from oscar import app
class MyShop(app.Shop):
def get_urls(self):
urls = super(MyShop, self).get_urls()
for index, u in enumerate(urls):
if u.regex.pattern == r'^catalogue/':
urls[index] = url(r'^catalog/', include(self.catalogue_app.urls))
break
return urls
application = MyShop()
5👍
You can try this
in app.py
from django.conf.urls import url, include
from oscar import app
class MyShop(app.Shop):
# Override get_urls method
def get_urls(self):
urls = [
url(r'^catalog/', include(self.catalogue_app.urls)),
# all the remaining URLs, removed for simplicity
# ...
]
urls = urls + super(MyShop,self).get_urls()
return urls
application = MyShop()
And in your urls.py
you can simply add this
from myproject.app import application as shop
url(r'', shop.urls),
Hope it help for you
- [Django]-MongoDB storage along with MySQL XPath features
- [Django]-Django run manage.py generates OS error in OS X Yosemite
0👍
You need to include the URLs, not reference them directly.
url(r'', include('application.urls')),
- [Django]-Whats the correct way to use and refer to a slugfield in a django 1.3
- [Django]-Django makemigrations No changes detected in app
Source:stackexchange.com