title: Requested setting DEFAULT_INDEX_TABLESPACE
body: <p>I'm making a <code>populate.py</code> script to transfer data from a <code>mysql</code> database to a <code>django mysqlite</code> database.</p>
  
  <p>I keep getting this error when I run my <code>populate.py</code> script:</p>
  
  <pre><code>Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured.
  You must either define the environment variable DJANGO_SETTINGS_MODULE
  or call settings.configure() before accessing settings.
  </code></pre>
  
  <p>So what I found from my researches was that I had to add <code>settings.configure()</code>, so I did that but still getting the error and have no clue anymore what it could be.</p>
  
  <p>This is what I import:</p>
  
  <pre><code>import django
  import time
  import datetime
  import os
  from mysql.connector import connection
  from django.conf import settings
  from user import models
  from techportal import models
  
  settings.configure()
  django.setup()
  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'itdb.settings')
  </code></pre>
  
  <p>I've made this function to transfer the data:</p>
  
  <pre><code># Insert all technologies
  def technologies():
      current = con_mysql.cursor()
      current_query = ("SELECT technology_id title, description, company_id, author, contactor, publish_date, edit_date, is_hidden, visible FROM technologies")
      current.execute(current_query)
  
      for (technology_id, title, description, company_id, author, contactor, publish_date, edit_date, is_hidden, visible) in current:
          # Converts datetime to (int)unixtimestamp
          if (publish_date == "0000-00-00 00:00:00"):
              publish_date = time.mktime(datetime.datetime.strptime(str(datetime.datetime.now().replace(microsecond=0)),
                                                                     "%Y-%m-%d %H:%M:%S").timetuple())
          else:
              publish_date = time.mktime(datetime.datetime.strptime(publish_date, "%Y-%m-%d %H:%M:%S").timetuple())
  
          # Converts datetime to (int)unixtimestamp
          if (edit_date == "0000-00-00 00:00:00"):
              edit_date = time.mktime(datetime.datetime.strptime(str(datetime.datetime.now().replace(microsecond=0)),
                                                                     "%Y-%m-%d %H:%M:%S").timetuple())
          else:
              edit_date = time.mktime(datetime.datetime.strptime(edit_date, "%Y-%m-%d %H:%M:%S").timetuple())
  
          mdl, succeeded = models.PortalTechnology.objects.get_or_create(
              author_id=author,
              basetech_id=technology_id,
              is_hidden=is_hidden,
              visible=visible
          )
          mdl.save()
  
          mdl, succeeded = models.Technology.objects.get_or_create(
              name=title,
              long_description=description,
              created_on=publish_date,
              supplier_id=company_id
          )
          mdl.save()
  
      current.close()
  </code></pre>