title: DJANGO_SETTINGS_MODULE not defined
body: <p>I'm trying to start a project in Django, but I've come up against a wall right at the start. Whenever I run django-admin with no commands, I get this notice after the help message: </p>
  
  <pre><code>Note that only Django core commands are listed as settings are not properly configured (error: Requested setting INSTALLED_APPS, 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>And whenever I try to run it or manage.py with a command such as runserver, I get:</p>
  
  <pre><code>python manage.py runserver
  Traceback (most recent call last):
  
  
  File "manage.py", line 22, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
      utility.execute()
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/__init__.py", line 355, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
      self.execute(*args, **cmd_options)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 62, in execute
      super(Command, self).execute(*args, **options)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
      output = self.handle(*args, **options)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 73, in handle
      if not settings.DEBUG and not settings.ALLOWED_HOSTS:
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
      self._setup(name)
    File "/home/castro/Code/django_tests/tutorial/lib/python3.6/site-packages/django/conf/__init__.py", line 39, in _setup
      % (desc, ENVIRONMENT_VARIABLE))
  django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, 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>I don't know how to define this DJANGO_SETTINGS_MODULE nor where to call settings.configure(). I've tried what some other answers here suggested, but either it's a different problem, or I'm missing something that should be quite obvious.</p>