1

first time posting here so my apologies if something is incorrect.

I am trying to build a simple queue system using Python's inbuilt Queue class in a Django application.
Python Queue Documentation https://docs.python.org/3/library/queue.html

I think I know how to construct and initialize a queue on site startup so there is only one queue I add jobs to based on this post Execute code when Django starts ONCE only?

However, my problem and question is after constructing a queue on Django site startup how would I grab that queue from my various Django apps in order to add jobs to it in the Views files?

I don't see a way to get the constructed queue. I could construct a queue at the time I want to add a job but then I would run into the issue where each job added would construct its own queue which is not the functionality I want.

so far I have a a queue_construction.py file in the base dir of my django site with some test functions in it and that is working great when I execute it on command line. Now I need to get it working in the Django environment. I do not want to use Celery or any other 3rd party software to do this.

Thanks in advance

hunch_hunch
  • 2,283
  • 1
  • 21
  • 26
  • 1
    You can't do that in a Django environment. Apart from anything else, it will almost always run in a multi-process setup, and there's no way for one process to gain access to data in another. Use an external queue. – Daniel Roseman Apr 09 '18 at 18:45
  • Hi @DanielRoseman. Thanks for your response. That would probably be why I couldn't think of a way to accomplish it. I'll do some more research into building a simple custom external queue. I really don't want to use any 3rd party software to do this. – Nick Miller Apr 09 '18 at 18:53

0 Answers0