title: How can I write a Groovy Jenkinsfile for a Django application to run my tests?
body: <p>I have recently started using Jenkins and I am wanting to use Multibranch Pipelines so I can test the various feature branches in my project. </p>
  
  <p>The project is using django 1.8. So far my Jenkinsfile looks like this and fails in the testing stage as django can not find my settings file even though it is there:</p>
  
  <pre><code>node {
      // Mark the code checkout 'stage'....
      stage 'Checkout'
  
      // Get the code from a GitHub repository
      git credentialsId: 'mycredentials', url: 'https://github.com/&lt;user&gt;/&lt;project&gt;/'
  
      // Mark the code build 'stage'....
      stage 'Build'
  
      env.WORKSPACE = pwd()
  
      sh 'virtualenv --python=python34 venv'
      sh 'source venv/bin/activate'
  
      sh 'pip install -r requirements.txt'
  
      env.DJANGO_SETTINGS_MODULE = "&lt;appname&gt;.settings.jenkins"
  
      // Start the tests
      stage 'Test'
      sh 'python34 manage.py test --keepdb'
  }
  </code></pre>