1

My site is named ficosa. I have a Django server set up with a sqlite database that contains a table named core_Data. Now, I am developing a python file named serverMQTT.py that should insert data into that sqlite database. This file is outside Django so in order to import the Django models from ficosa site I call django.setup()

import django
from django.conf import settings
from ficosa import settings as fsettings

settings.configure(default_settings=fsettings, DEBUG=True)

django.setup()

Now this script or any imported module can use any part of Django it needs.

from core.models import Data

However, I am having an error:

AttributeError: 'module' object has no attribute 'LOGGING_CONFIG'

I would be gratefull if sombody could help me

1
  • As a side note, do not use SQLite in production unless you have good reason to. Commented Nov 18, 2015 at 10:34

1 Answer 1

3

That's not how you configure settings in a standalone app. Note what the documentation says:

Be aware that if you do pass in a new default module, it entirely replaces the Django defaults, so you must specify a value for every possible setting that might be used in that code you are importing.

Presumably, your fsettings module only contains database settings. In which case, just override that one thing:

settings.configure(DATABASES=fsettings.DATABASES, DEBUG=True)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.