Reputation: 143
can i include the same app url conf within two different root?
I mean, i have this
(r'^event/', include('quip.apps.event.urls')),
but i would like to have that
(r'^event/', include('quip.apps.event.urls')), #display event e.g. event/my-event-slug
(r'^events/', include('quip.apps.event.urls')), #filter events e.g. events/today/somewhere
I need different behavior in my 'quip.apps.event.urls'. the only solution that come in my mind is to create two urls file, but i don't think is a quite really good solution.
(r'^event/', include('quip.apps.event.someurls')),
(r'^events/', include('quip.apps.event.otherurls')),
any ideas? i'm sure this is a silly question.
Upvotes: 0
Views: 213
Reputation: 99680
Yes you can. To keep it modular, I would make urls
a package:
(r'^event/', include('quip.apps.event.urls.someurls')),
(r'^events/', include('quip.apps.event.urls.otherurls')),
Where the directory structure would be
event/
__init__.py
urls/
__init__.py
someurls.py
otherurls.py
Also, in urls/__init__.py
you could do
from .someurls import *
from .otherurls import *
Upvotes: 2