title: How can I correctly set DJANGO_SETTINGS_MODULE for my Django project (I am using virtualenv)?
body: <p>I am having some trouble setting the DJANGO_SETTINGS_MODULE for my Django project.</p>
  
  <p>I have a directory at <code>~/dev/django-project</code>.  In this directory I have a virtual environment which I have set up with virtualenv, and also a django project called "blossom" with an app within it called "onora".  Running <code>tree -L 3</code> from <code>~/dev/django-project/</code>  shows me the following:</p>
  
  <pre><code>.
  ├── Procfile
  ├── blossom
  │   ├── __init__.py
  │   ├── __init__.pyc
  │   ├── fixtures
  │   │   └── initial_data_test.yaml
  │   ├── manage.py
  │   ├── onora
  │   │   ├── __init__.py
  │   │   ├── __init__.pyc
  │   │   ├── admin.py
  │   │   ├── admin.pyc
  │   │   ├── models.py
  │   │   ├── models.pyc
  │   │   ├── tests.py
  │   │   └── views.py
  │   ├── settings.py
  │   ├── settings.pyc
  │   ├── sqlite3-database
  │   ├── urls.py
  │   └── urls.pyc
  ├── blossom-sqlite3-db2
  ├── requirements.txt
  └── virtual_environment
      ├── bin
      │   ├── activate
      │   ├── activate.csh
      │   ├── activate.fish
      │   ├── activate_this.py
      │   ├── django-admin.py
      │   ├── easy_install
      │   ├── easy_install-2.7
      │   ├── gunicorn
      │   ├── gunicorn_django
      │   ├── gunicorn_paster
      │   ├── pip
      │   ├── pip-2.7
      │   ├── python
      │   └── python2.7 -&gt; python
      ├── include
      │   └── python2.7 -&gt; /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
      └── lib
          └── python2.7
  </code></pre>
  
  <p>I am trying to dump my data from the database with the command </p>
  
  <pre><code>django-admin.py dumpdata
  </code></pre>
  
  <p>My approach is to run <code>cd ~/dev/django-project</code> and then run <code>source virtual_environment/bin/activate</code> and then run <code>django-admin.py dumpdata</code></p>
  
  <p>However, I am getting the following error:</p>
  
  <pre><code>ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
  </code></pre>
  
  <p>I did some googling and found this page: <a href="https://docs.djangoproject.com/en/dev/topics/settings/#designating-the-settings" rel="noreferrer">https://docs.djangoproject.com/en/dev/topics/settings/#designating-the-settings</a></p>
  
  <p>which tell me that</p>
  
  <blockquote>
    <p>When you use Django, you have to tell it which settings you're using.
    Do this by using an environment variable, DJANGO_SETTINGS_MODULE.  The
    value of DJANGO_SETTINGS_MODULE should be in Python path syntax, e.g.
    mysite.settings. Note that the settings module should be on the Python
    import search path.</p>
  </blockquote>
  
  <p>Following a suggestion at <a href="https://stackoverflow.com/questions/7598793/setting-django-settings-module-under-virtualenv">Setting DJANGO_SETTINGS_MODULE under virtualenv?</a> I appended the lines</p>
  
  <pre><code>export DJANGO_SETTINGS_MODULE="blossom.settings"
  echo $DJANGO_SETTINGS_MODULE
  </code></pre>
  
  <p>to virtual_environment/bin/activate.  Now, when I run the activate command in order to activate the virtual environment, I get output reading:</p>
  
  <pre><code>DJANGO_SETTINGS_MODULE set to blossom.settings
  </code></pre>
  
  <p>This looks good to me, but now the problem I have is that running</p>
  
  <pre><code>django-admin.py dumpdata
  </code></pre>
  
  <p>returns the following error:</p>
  
  <pre><code>ImportError: Could not import settings 'blossom.settings' (Is it on sys.path?): No module named blossom.settings
  </code></pre>
  
  <p>What am I doing wrong?  How can I check the<code>sys.path</code>?  How is this supposed to work?</p>
  
  <p>Thanks.</p>