Thursday, September 26, 2019

Conflicting settings import

I installed a pyhton package. The package requires django to display some
html pages. The thing is, I want to use this package in my django project.
However, one of the modules imports "from django.conf import settings from
django.template import Context, Template". This cause "RuntimeError:
Settings already configured". How can I make both settings that are imported
in my django project and the python package's work seamlessly?
I tried this, but it just causes more problems.
if not settings.configured:

I understand that is code is configuring the django conf settings. Clearly,
this package has its own templates. How can I make sure that my templates
are still working while still allowing the template in the package are still
working too? Both are needed from my django project.

Link to part of the python package that is also importing
This is code from the python package that is causing the problem:
_dirname, _filename = os.path.split(os.path.abspath(__file__))
ONTODOCS_VIZ_TEMPLATES = _dirname + "/media/templates/"
ONTODOCS_VIZ_STATIC = _dirname + "/media/static/"

if StrictVersion(django.get_version()) > StrictVersion('1.7'):
from django.conf import settings
from django.template import Context, Template

settings.TEMPLATES = [
'DIRS': [
# insert your TEMPLATE_DIRS here
'context_processors': [
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use
# list if you haven't customized them:

from django.conf import settings
from django.template import Context, Template

*Is there a way to move all the template directories from the python package
and configure them in my django project*

Sent from:

You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

No comments:

Post a Comment