title: How to detect if script ran from Django or command prompt?
body: <p>I have a Python script that pauses for user input (using <code>raw_input</code>, recently I created a Django web UI for this script. Now when I execute the script via Django is pauses as it's waiting for input in the backend. </p>
  
  <p>How can I determine if the script was ran from Django or terminal/cmd/etc? I don't want to maintain 2 streams of code, one for web and another one for terminal.</p>