I was wondering if it is possible to link to two different views.py files (in different directories) within one urls.py, and how this might be done?
More specifically, I am looking for a way to include the views.py from 'myapp' directory in urls.py in 'details' directory together with the views.py that is in 'details'.
Thanks for any help !
its possible , you need to import your views with different names , if they have same name you can do this :
from . import views from another.directory import views as views2 urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^test/', views2.index, name='index2')), ]
but its not a cool idea , you can define the second URL in the views.py related to the module .