How can I access templates from an imported Django application?

35 Views Asked by At

I want to pip install a Django application and be able to access its templates when adding it to the "INSTALLED_APPS" section in Django project's "settings.py" file.

I followed the tutorial here to build a Django app and export it as an installable package, then installed this package into the virtual environment of another Django project. Everything works fine when I add the app's name in INSTALLED_APPS and when I include the urls of the imported app in the project's urls.py file.

However, when I run the lightweight server of the Django project and try to access one of the imported app's page, I get a "django.template.exceptions.TemplateDoesNotExist" error. Why would Django allow to access the urls and views of an imported app, but not its templates or templatetags?

When running the server and sending a request to it for a specific web page, I was expecting to get this web page (located in the templates of the imported app) to load on my browser.

1

There are 1 best solutions below

1
Gabriel On

The MANIFEST.in file was incorrectly setup (it used the wrong names), which led to the templates and static files not being created in the package.