In other hand, it's possible to use the Django server to intercept a requests?
SM Il giorno domenica 16 febbraio 2014 15:20:54 UTC+1, simone monteleone ha scritto: > > 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? > > Thanks > > SM > > > > Il giorno domenica 16 febbraio 2014 01:21:46 UTC+1, Russell Keith-Magee ha > scritto: >> >> Hi Simone, >> >> On Sun, Feb 16, 2014 at 2:53 AM, simone monteleone <ares...@gmail.com>wrote: >> >>> 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 >>> >> >> Do you want the *file*, or the *data contained in the file*? >> >> Based on the script you've provided, you want the *data*. If so, you >> don't run a script like this at a URL. You run it at a Python prompt. >> >> When you went through the Django tutorial, the first steps were all done >> at a prompt. Those commands let you inspect the data that was in the >> database. You can also use the prompt to *create* data in the database - >> that's what your script needs to do. >> >> You don't need to upload the script to the server, or write any view code >> - you're writing a set of commands that you will run at a prompt to open a >> file, read some data, and write to the database. Then you can start your >> Django server, and see that data *on* your server. >> >> Is that more clear? >> >> 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+unsubscr...@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/3bf8f942-d3fe-432e-8730-a9673ca1eadc%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.