Hi all,
I have to send a file (ex. csv file) to the Django server.
I think to use the requests python module.
Is this the best way?
Second question; Django can receive this file?
And also in this case, what it is the best way?
My goal is to load the csv file information in the dabatase handles by django,
Hi Russ,
My goal is to load the csv file directly in the database.
So my idea is define a script containing the follow pseudo-code:
while(1) and receive_csv():
value1, value2 = read_csv()
MyModel.objects.create(field1=value1, field2=value2)
The script run on the server, ex http://127.0.0.1:8000/admin
Hi Russ,
The script is now running in a normal bash shell, where I import the DJANGO_SETTINGS_MODULE.
So it's correct to run the script on the machine where the server goes?
Or it's possible (and better) runs the commands inside Django?
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.