[Answered ]-Django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TAB LESPACE, but settings are not configured

2๐Ÿ‘

โœ…

I figured out how to run it without changing the script and thatโ€™s by using

python manag.py shell

and then

exec(open('filename').read())

that seemed to work just fine.

๐Ÿ‘คmari

0๐Ÿ‘

I would recommend using Django Custom Management Commands โ€“ they are really simple to use, they use your settings, your environment, you can pass parameters and also you can write help strings so you can use --help

Then you just call it with ./manage.py my_custom_command

Or if you just want to run your script add this to the your script

project_path = '/home/to/your/trailers/project/src'
if project_path not in sys.path:
    sys.path.append(project_path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "trailers.common")

import django
django.setup()
๐Ÿ‘คsebb

Leave a comment