I have a Django model that represents data files on a server, with some metadata about each file. These files are generated by an instrument and can appear at any time throughout the day. I would like the Django table to reflect the files that are actually available for the user to select.
Here is what I have so far:
- I have a python script that scans the directory, produces an intial_data.json file and puts it in the app/fixtures directory. (The script pulls out important metadata from each file to make it easy for the user to make selections.)
- I have fixtures working so that when I run syncdb, it loads the data into the model.
My question is, how do I do this repeatedly (hourly? on-demand? -- for example, triggered by clicking a button on the page?)
My impression is that syncdb is only meant to be run occasionally, like, for a data migration. Am I wrong - can I run it "at the click of a button"?
Is there a better way of keeping my table in sync with the file system? I have considered using FileField or FilePathField but these seem not workable, because I want to pre-load the table with the file metadata.
loaddatacommand instead ofsyncdb: docs.djangoproject.com/en/dev/ref/django-admin/…