only start recalculate thread for command 'runserver'
This commit is contained in:
parent
92d554aab3
commit
cf3b812549
@ -375,8 +375,16 @@ def outgoing_to_csv(outgoing, f, difference=False):
|
|||||||
writer.writerow(["Getränke.Erträge", sum / 100.0])
|
writer.writerow(["Getränke.Erträge", sum / 100.0])
|
||||||
print(outgoing.inventory.date, sum / 100.)
|
print(outgoing.inventory.date, sum / 100.)
|
||||||
|
|
||||||
# TODO: don't do this here in production mode...
|
|
||||||
recalculate_thread = RecalculateThread()
|
import sys
|
||||||
recalculate_thread.daemon = True
|
is_runserver_command = False
|
||||||
recalculate_thread.start()
|
for idx, value in enumerate(sys.argv):
|
||||||
|
if value.endswith("manage.py"):
|
||||||
|
is_runserver_command = sys.argv[idx + 1] == "runserver"
|
||||||
|
break
|
||||||
|
|
||||||
|
if is_runserver_command:
|
||||||
|
recalculate_thread = RecalculateThread()
|
||||||
|
recalculate_thread.daemon = True
|
||||||
|
recalculate_thread.start()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user