Reputation: 271824
According to this documentation, I have to put something in management.py so that things are created when I run "syncdb"
Where do I do that? I don't see management.py anywhere.
http://code.google.com/p/django-notification/wiki/IntegratingNotification#Creating_Notice_Types
Upvotes: 6
Views: 2523
Reputation: 3010
django.db.models.signals.pre_syncdb
Sent by the syncdb command before it starts to install an application.
Any handlers that listen to this signal need to be written in a particular place: a management module in one of your INSTALLED_APPS. If handlers are registered anywhere else they may not be loaded by syncdb.
That's because syncdb will not load all the parts of the django project, so if you would define your signals for syncdb in models.py
, it would not find it, but signals defined in here don't need to be anywhere else in the framework.
Upvotes: 0
Reputation: 49
Not every module in django app is executed upon project start. Only models.py is. It's ugly but you can put the code in there. The management.py
file is probably a mistake.
Upvotes: 0
Reputation: 410672
Put it in the relevant app's directory. For example, if you have a project like:
my_project/
my_app/
models.py
views.py
tests.py
Stick it here:
my_project/
my_app/
management.py
models.py
views.py
tests.py
(That will make a management module within the *my_app* package, in Python terminology.)
Upvotes: 6