$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[DJUGL] Signals and AppConfig
Search
Ana Balica
October 06, 2015
Programming
0
340
[DJUGL] Signals and AppConfig
Django User Group in London meetup and my talk about "Signals and AppConfig" Rick and Morty style!
Ana Balica
October 06, 2015
Tweet
Share
More Decks by Ana Balica
See All by Ana Balica
[NDC London] HTTP: History & Performance
anabalica
0
640
[DjangoCon US] Testing in Django
anabalica
1
1.4k
HTTP: History & Performance
anabalica
1
590
[DUTH] Testing in Django
anabalica
4
9.7k
[PyCon US 2016] To mock or not to mock, that is the question
anabalica
0
350
[DjangoCon Europe 2016] To mock or not to mock, that is the question
anabalica
0
500
[PyLadies London 2015] How to write a good commit message
anabalica
0
420
[EuroPython 2015] Demystifying Mixins with Django
anabalica
0
390
[DjangoCon Europe 2015] Demystifying Mixins with Django
anabalica
0
350
Other Decks in Programming
See All in Programming
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.4k
Cell-Based Architecture
larchanjo
0
140
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
520
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
250
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
1.5k
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
140
これならできる!個人開発のすゝめ
tinykitten
PRO
0
120
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
460
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
180
AIコーディングエージェント(Gemini)
kondai24
0
260
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
560
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
The agentic SEO stack - context over prompts
schlessera
0
550
Typedesign – Prime Four
hannesfritz
42
2.9k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Believing is Seeing
oripsolob
0
15
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
400
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
1
200
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Marketing to machines
jonoalderson
1
4.3k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
0
91
Information Architects: The Missing Link in Design Systems
soysaucechin
0
710
Transcript
SIGNALS AND APPCONFIG DJUGL October 6, 2015
@anabalica
Let’s get schwifty with !
from django.db.models.signals import post_save from django.dispatch import receiver from myapp.models
import MyModel @receiver(post_save, sender=MyModel) def my_handler(sender, **kwargs): pass # my_app/signals.py
from django.db.models.signals import pre_save from django.dispatch import receiver from myapp.models
import MyModel @receiver(pre_save, sender=MyModel) def my_handler(sender, **kwargs): pass # my_app/signals.py
Django<1.7? make sure that the module it’s in gets imported
early on so that the signal handling gets registered before any signals need to be sent
Django<1.7? make sure that the module it’s in gets imported
early on so that the signal handling gets registered before any signals need to be sent
Django<1.7? this makes your app’s models.py a good place to
put registration of signal handlers
from django.db import models from my_app import signals class MyModel(models.Model):
pass # my_app/models.py
None
CIRCULAR IMPORTS
from my_app import signals # my_app/__init__.py
None
AppConfig to the rescue
AppConfig is a registry of installed apps and available models
>>> from django.apps import apps >>> apps.get_app_config('admin').verbose_name 'Admin'
from django.apps import AppConfig class RickNMortyConfig(AppConfig): name = "rick_n_morty" verbose_name
= "Rick and Morty" # my_app/apps.py
INSTALLED_APPS = [ "my_app.apps.RickNMortyConfig", # ... ] # settings.py or
default_app_config = "my_app.apps.RickNMortyConfig" # my_app/__init__.py
None
from django.apps import AppConfig class RickNMortyConfig(AppConfig): name = "rick_n_morty" verbose_name
= "Rick and Morty” def ready(self): from my_app import signals # my_app/apps.py
• Loads the settings • Sets up logging • Initializes
the application registry
• Imports each item from INSTALLED_APPS • Imports the models
submodule if exists • Runs the ready() method of each app config
None