-1

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.

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

#python code generating value1 and value2

def displayValues(request):

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

  return render(request, 'interface.html', context)

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.

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.

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.

I've seen this but it is more to do with using the Model outside of the standard setup. Using Django database layer outside of Django?

Is this possible?

Thanks!

Community
  • 1
  • 1
Spinnaay
  • 119
  • 1
  • 12

1 Answers1

0

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

https://docs.python.org/2/library/simplehttpserver.html

idik
  • 872
  • 2
  • 10
  • 19
  • Thanks, I'll have a look. My interest is mainly that I understand Django templates and find it very easy to design web pages displaing values passed to it from python. – Spinnaay Oct 03 '16 at 15:18