I have an installed app called 'publications' and I am trying to call the 'publications' views from within my Django project. I keep getting the following error:
from citations_app import views as citations_app_views
ImportError: No module named citations_app
So, I can't "load" the external app's views and, if I could, am not sure if I'm calling it correctly. I'm trying to use my "display_info" view function to get a list of data and then pass that data to the external app's "list_view" view function. Here is my citations.py view file:
from django.db.models import get_app
citations_app = get_app("publications")
from citations_app import views as citations_app_views
from citations_app_views import list as list_view
def display_info(request):
citations = request.GET.getlist('citation-selection')
return list_view(request, citations)
Any idea why I get the import error and if I am calling the "list_view" view function correctly? Thank you!!
DIRECTORY STRUCTURE:
MyApp1/
models/
publications.py
citations.py
items.py
views/
publications.py
citations.py
items.py
MyApp2/
Publications/ (not physically present at this location but installed as part of requirements.txt file)
I am working in views/items.py.
INSTALLED_APPS??get_app()—a private API that has been deprecated—instead of Python's regular import mechanism (from publications import views as citations_app_views)?from publications import views as citations_app_views, I get anImportError: cannot import name views.