Using Django outside of view.py
<p>I have a twisted based script running that is managing IO, monitoring serial inputs, writing logs etc. It uses Twisted to run events every minute and every hour as well as interrupt on serial traffic.</p>

<p>Can Django be used to provide an interface for this, for example taking live values and display them using </p>

<pre><code>#python code generating value1 and value2

def displayValues(request):

  context = {
      'value1':value1,
      'value2':value2
  }

  return render(request, 'interface.html', context)
</code></pre>

<p>The obvious issue is that this python file doesn't live in the Django file setup and so the URL call wouldn't know where to look or how to call the displayValues function. </p>

<p>An additional feature I might look to is to write the IO values in to a mysql database through Django as it is already setup.</p>

<p>I understand Django from a simple databases application point of view but this is not something I've come across online and I might be moving outside of the scope of Django.</p>

<p>I've seen this but it is more to do with using the Model outside of the standard setup. <a href="http://stackoverflow.com/questions/2180415/using-django-database-layer-outside-of-django">Using Django database layer outside of Django?</a></p>

<p>Is this possible?</p>

<p>Thanks! </p>

<p>Why do you need Django for such a simple use case?
For simple Http requests you can you the included Python tool:</p>

<p><a href="https://docs.python.org/2/library/simplehttpserver.html" rel="nofollow">https://docs.python.org/2/library/simplehttpserver.html</a></p>

python django twisted