Hi- It’ my first time posting here but I have read a lot. Thank you to all the contributors, this is a great community. I believe that my problem is fairly simple / common but I somehow could not find a great answer to it on here or on Stack Overflow.
I am building a fairly simple applications that pulls data from a database and let’s a user interact with it (do uploads, edits, deletes) via a web interface. We are using Django for the backend and React JS for the front end.
The project structure is pretty straightforward:
- myproject_django / myproject holds all the backend stuff
- myproject_react holds all the frontend stuff
I have a separate set of scripts that do bulk imports of data into the tables, etc. these sit in another directory on the same level as the other 2:
- myproject_django / myproject
- myproject_react
- bulk_data_operations
Today, the bulk_data_operations scripts are run from the command line and connect directly to the database and use native SQL to do their thing. I would love to use the Django models to simplify the SQL generation / maintenance and take advantage of Django migration capabilities. I have Django models defined inside myproject.
What would be the cleanest way to migrate the bulk_data_operations scripts to be able to use the Django models for “one-off” bulk data operations? Would it be to move them inside of the Django project? If so, my understanding is that these scripts would stop being command-line scripts and would need to be triggered through a view or something of the like. Is this correct? Does it mean that I would have to create a separate Admin UI to be able to execute these scripts?
Any help would be greatly appreciated. Thank you!