Import a django app view in another app view -
i have 2 django apps , i've called view of app1 in app2, this:
#app: app1 #someview.py def a_view(request, someparam): #some code here #app: app2 #otherview.py app1.someview import a_view def another_view(request): param = 1 a_view(request, param) def view2(request): #some code
it works fine. problem want call view app2 in app1. add import statement in someview.py this:
#app: app1 #someview.py app2.otherview import view2 def a_view(request, someparam): #some code here
the result importerror "cannot import name view2". can tell me why happen?
the second import shadowing first 1 ... try
import app2.otherview
or
from app2.views app2_views
Comments
Post a Comment