lazybird/django-solo

django.template.exceptions.TemplateDoesNotExist: admin/solo/change_form.html

Vayel opened this issue · 8 comments

Vayel commented

Hi!

When I go to my singleton model's admin change page, I get the exception django.template.exceptions.TemplateDoesNotExist: admin/solo/change_form.html. I'm working with Django 3.1.1.

The problem is that the egg file of the package is a zip file and not a directory (the extraction did not happen). But Django's default template loader can find templates in directories only: https://github.com/django/django/blob/0b8871ab6744285943784795ede053839ee009ef/django/template/utils.py#L94

To force the unzip, you need to set the zip-safe option to False: https://setuptools.readthedocs.io/en/latest/formats.html#zip-safe-and-not-zip-safe. You can do so in the setup.py file:

# ...
setup(
    # ...
    zip_safe=False,
)

Thanks!

Hi, is there some news? I've the same issue
I'm using django==3.0.5

As a temporary solution I've copied the template file from github inside the folder admin/solo of my template directory to ovverride it

Vayel commented

@nicokant I don't understand why but when I installed the package with poetry, the error disappeared. It may be related to the Python version (3.8 with poetry, 3.6 with the bug).

I'm using Python 3.8 (inside a docker container) and pip for installing, but still have this issue.

Vayel commented

I had the problem inside a docker container as well.

Had the same issue, fixed it by adding "solo" to installed apps in settings

Which version of django-solo are you using? The PR mentioned above (#82) has been merged since, and the latest version is now 1.1.5