Here’s a question from someone who has just started working with the Django framework. I am developing an app for project management and want to generate an update to Slack depending on a project status. I may want to use this piece of code again later. So initially I have a new Django app, but since I’m just pushing to Slack I don’t have any URL routing or models. I can also create a separate .py file with a Slack function within my project management app.
What is the best practice for this?
When do you want these updates pushed?
-
Are they being sent as a result of some other data being updated in your system?
-
Are they being sent periodically? (Like once per day?)
-
Are they to be sent when someone “pushes a button” to send them?
How long does it take for these updates to be sent?
I was asking how long your process takes to run. I don’t know if your “Slack update” can complete in 1 second, 10 seconds, 100 seconds or 1000 seconds or more. Each one of those possibilities has implications regarding the best way to handle this.
Assuming it fits into the 10 seconds or less category, I would just do the update in the view that updates the project phase. (I may physically place the code in a different function - I wouldn’t necessary include it directly in the view, but I would call that function from the view.) I don’t see a reason to do anything else.