Permalink
Browse files

Added startup and receivers support

Project modules will now contain a startup.py. This file defines a single run
method that is called on Django startup.

In addition to startup support the project understands the receivers.py. This
file can be used to hook up signal receivers which otherwise end up in models.py
or other funky places where it should not be.
  • Loading branch information...
1 parent 25e7b46 commit 25edb4dd3fc6fae197205b567f084da7c757e11b @brosner brosner committed Jan 24, 2013
Showing with 5 additions and 2 deletions.
  1. +2 −2 manage.py
  2. +3 −0 project_name/wsgi.py
View
@@ -3,7 +3,7 @@
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
-
from django.core.management import execute_from_command_line
-
+ import {{ project_name }}.startup as startup
+ startup.run()
execute_from_command_line(sys.argv)
View
@@ -17,6 +17,9 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings")
+import {{ project_name }}.startup as startup
+startup.run()
+
# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.

0 comments on commit 25edb4d

Please sign in to comment.