The right place to keep my signals.py file in a Django project

If you’re using Django<=1.6 I’d recommend Kamagatos solution: just import your signals at the end of your models module. For future versions of Django (>=1.7), the recommended way is to import your signals module in your app’s config ready() function: my_app/apps.py from django.apps import AppConfig class MyAppConfig(AppConfig): name=”my_app” def ready(self): import my_app.signals my_app/__init__.py default_app_config = … Read more

Django signals vs. overriding save method

Save/delete signals are generally favourable in situations where you need to make changes which aren’t completely specific to the model in question, or could be applied to models which have something in common, or could be configured for use across models. One common task in overridden save methods is automated generation of slugs from some … Read more

TransactionManagementError “You can’t execute queries until the end of the ‘atomic’ block” while using signals, but only during Unit Testing

I ran into this same problem myself. This is caused by a quirk in how transactions are handled in the newer versions of Django coupled with a unittest that intentionally triggers an exception. I had a unittest that checked to make sure a unique column constraint was enforced by purposefully triggering an IntegrityError exception: def … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)