4 ms·
I usually write my scripts in a temporary file and run them through Django with something like: $ python manage.py shell <~/tmp-script.py In this instance
by taylorfausak 15y ago
I usually write my scripts in a temporary file and run them through Django with something like:
$ python manage.py shell <~/tmp-script.py
In this instance, I didn't even consider that what I was doing could be catastrophic. But you're right, you want to avoid doing things manually. In the future, I'll track all the scripts I run. And thanks for the tip about Fabric, I'll check it out.
- JonnieCache 15y agoFor bonus points, clone your production db locally and test your script against it a few times first. Or, you know, have a staging server.
- umarmung 15y agoExactly. This is the reason why enterprises always use staging servers with test suites. It is irrelevant if you use NoSQL, SQL, or magic, if you don't have development+staging+production platforms for a business reliant on an information system, you're doing it wrong and it will bite you hard eventually.
- mikeryan 15y agoThe advice isn't about how you do the script. You should never, ever be running test scripts and code against a production db.