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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
590
[DUTH] Testing in Django
anabalica
4
9.7k
[PyCon US 2016] To mock or not to mock, that is the question
anabalica
0
360
[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
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
470
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
180
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
450
kintone + ローカルLLM = ?
akit37
0
120
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
210
2025年の活動の振り返り
hideg
0
120
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
240
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
170
Package Management Learnings from Homebrew
mikemcquaid
0
280
今、アーキテクトとして 品質保証にどう関わるか
nealle
0
180
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
3
320
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
190
Featured
See All Featured
Utilizing Notion as your number one productivity tool
mfonobong
3
230
What does AI have to do with Human Rights?
axbom
PRO
0
2k
HDC tutorial
michielstock
1
460
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
130
[SF Ruby Conf 2025] Rails X
palkan
2
790
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
180
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Skip the Path - Find Your Career Trail
mkilby
0
68
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
77
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Rails Girls Zürich Keynote
gr2m
96
14k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
340
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