[Django]-Requested setting DEFAULT_INDEX_TABLESPACE

2👍

According to this answer and also this answer you need to first set the env variable and then call django.setup():

File your_script.py:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings")
import django
django.setup()

# here goes the rest of your script ...
import time
import datetime
from mysql.connector import connection
from user import models
from techportal import models

def technologies():
    ...

This is necessary since django 1.7 (see release notes).

And settings.configure() should not be necessary this way.

👤Ralf

Leave a comment