title: Django running wrong view method
body: <p>I have to view files stored in mysite folder. one is named as views.py and other is named as request_view.py. In urls.py, I have used 'answer' method for views.py and 'display_meta' method for request_view.py.</p>
  
  <p>(django version: 1.5 and python version: 2.7.3)</p>
  
  <p>this is the url pattern:</p>
  
  <pre><code>url(r'^twitter/$', answer), url(r'request/$', display_meta)
  </code></pre>
  
  <p>when  I call http:/127.0.0.1:8000/request/, then also first view(i.e. /twitter/) is called!</p>
  
  <p>any help?</p>
  
  <p>one more thing. In my view.py, I have some unbounded code (i.e. the code which is neither present in a method or class). can this be the cause of the problem?</p>
  
  <pre><code>l = StdOutListener()
  auth = OAuthHandler(consumer_key, consumer_secret)
  auth.set_access_token(access_token, access_token_secret)
  stream = Stream(auth, l)
  keyword = input('enter the keyword you want to search for?')
  stream.filter(track = [keyword])
  </code></pre>
  
  <p>apart from this code, evry code is either in the class or method.</p>
  
  <p>One thing that I noticed is that first the code of the view.py runs, then display_meta runs.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>SOLVED</strong></p>
  
  <p>The problem was with the import function that I was using. since my code was unbounded in one of the views, the import function always import that regardless of the url that I choose. </p>
  
  <p><strong>Suggestion</strong></p>
  
  <p>Always use the nomenclature mentioned in the this <a href="https://docs.djangoproject.com/en/1.5/topics/http/urls/#example" rel="nofollow">example</a>. In many books it has been suggested that we should import the views, but it might cause an error if you have <strong>unbounded code</strong> like I had.</p>