Django_nuuuub Django_nuuuub - 2 months ago 13
Python Question

Django: import two different views to same

I was wondering if it is possible to link to two different files (in different directories) within one, and how this might be done?

More specifically, I am looking for a way to include the from 'myapp' directory in in 'details' directory together with the 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 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 related to the module .