Changes between Initial Version and Version 1 of Ticket #33297, comment 4


Ignore:
Timestamp:
Apr 5, 2022, 8:56:19 AM (2 years ago)
Author:
Azzonith

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33297, comment 4

    initial v1  
    661. Create models.
    772. Import models by setting up Django in any python module
     8
     9{{{
    810os.environ['DJANGO_SETTINGS_MODULE'] = 'ServiceName.settings'
    911django.setup()
    1012from ServiceName.models import ModelName
    1113
     14}}}
     15
    12163. Use models via django ORM to fetch some data from DB on service startup(lets call it step 1) and later on by some triggers(lets call it step 2). In my case data is fetched once on startup, and all the subsequent times on certain Kafka event.
    1317e.g.
     18
     19{{{
    1420query_results = ModelName.objects.filter(your_filter=some_value)
     21}}}
     22
    1523
    16244. Shutdown PostgreSQL instance after step one, but before step 2
Back to Top