On Tue, Feb 18, 2014 at 4:10 PM, simone monteleone <ares.aras@gmail.com> wrote:
Hi Russ,
:) +1 for your example.
I read the Django documentation and I find the Middleware chapter.
It's possible using the Middleware layer to intercept the HTTP requests.
The "script solution" remain the simplest solution.
My goal is the implementation of system, composed by two devices:
- a data logger
- a web service
The data logger have to send the registered data to the web server.
I think to use an https comunication between the two devices.
So on the same machine, where I install the web server, I need another web server to handle the
data logger requests.
This is a possible solution.
Ok - this is why you need to provide all the details when you ask a question. What you've described here is a completely different problem to the one you've described so far, and one that *would* be well suited to receiving a file via URL, rather than using a script on the server.
So, yes - you write a view on the server that accepts a file upload, and when that file is uploaded, you read it and process it. The data logger itself can absolutely use requests to push this data; you could also use curl, or any other HTTP tool.
However, a bigger question -- how many "rows" of data will each CSV file contain?
If it's only one - perhaps you should consider using a HTTP POST, rather than sending a file with one line in it.
If it's a small number - maybe you should consider modifying your data logger so that it can send just one record at a time
If it's a *large* number of rows, consider the performance of your web server. Web servers are designed to respond quickly. They don't behave well with long lived processes. You may need to investigate handing the uploaded data using a background queue.
Yours,
Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq8482iy%2BAW2Vr7%3Di_Q7uqf5UVYsL0FObqmjGoPXgfA2rrWg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment