Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
350
[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
650
[DjangoCon US] Testing in Django
anabalica
1
1.5k
HTTP: History & Performance
anabalica
1
600
[DUTH] Testing in Django
anabalica
4
9.7k
[PyCon US 2016] To mock or not to mock, that is the question
anabalica
0
370
[DjangoCon Europe 2016] To mock or not to mock, that is the question
anabalica
0
520
[PyLadies London 2015] How to write a good commit message
anabalica
0
420
[EuroPython 2015] Demystifying Mixins with Django
anabalica
0
410
[DjangoCon Europe 2015] Demystifying Mixins with Django
anabalica
0
360
Other Decks in Programming
See All in Programming
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
140
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
210
Event Storming
hschwentner
3
1.3k
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
440
CSC307 Lecture 12
javiergs
PRO
0
450
Head of Engineeringが現場で回した生産性向上施策 2025→2026
gessy0129
0
210
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
190
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
270
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
490
AIに仕事を丸投げしたら、本当に楽になれるのか
dip_tech
PRO
0
180
TROCCOで実現するkintone+BigQueryによるオペレーション改善
ssxota
0
120
Python’s True Superpower
hynek
0
200
Featured
See All Featured
The SEO Collaboration Effect
kristinabergwall1
0
380
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
850
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Scaling GitHub
holman
464
140k
Facilitating Awesome Meetings
lara
57
6.8k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.1k
[SF Ruby Conf 2025] Rails X
palkan
2
810
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.8k
Darren the Foodie - Storyboard
khoart
PRO
3
2.7k
KATA
mclloyd
PRO
35
15k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
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