hookspec_django_settings.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. from .hookspec import hookspec
  2. ###########################################################################################
  3. @hookspec
  4. def get_INSTALLED_APPS():
  5. """Return a list of apps to add to INSTALLED_APPS"""
  6. # e.g. ['your_plugin_type.plugin_name']
  7. return []
  8. @hookspec
  9. def register_INSTALLED_APPS(INSTALLED_APPS):
  10. """Mutate INSTALLED_APPS in place to add your app in a specific position"""
  11. # idx_of_contrib = INSTALLED_APPS.index('django.contrib.auth')
  12. # INSTALLED_APPS.insert(idx_of_contrib + 1, 'your_plugin_type.plugin_name')
  13. pass
  14. @hookspec
  15. def get_TEMPLATE_DIRS():
  16. return [] # e.g. ['your_plugin_type/plugin_name/templates']
  17. @hookspec
  18. def register_TEMPLATE_DIRS(TEMPLATE_DIRS):
  19. """Install django settings"""
  20. # e.g. TEMPLATE_DIRS.insert(0, 'your_plugin_type/plugin_name/templates')
  21. pass
  22. @hookspec
  23. def get_STATICFILES_DIRS():
  24. return [] # e.g. ['your_plugin_type/plugin_name/static']
  25. @hookspec
  26. def register_STATICFILES_DIRS(STATICFILES_DIRS):
  27. """Mutate STATICFILES_DIRS in place to add your static dirs in a specific position"""
  28. # e.g. STATICFILES_DIRS.insert(0, 'your_plugin_type/plugin_name/static')
  29. pass
  30. @hookspec
  31. def get_MIDDLEWARE():
  32. return [] # e.g. ['your_plugin_type.plugin_name.middleware.YourMiddleware']
  33. @hookspec
  34. def register_MIDDLEWARE(MIDDLEWARE):
  35. """Mutate MIDDLEWARE in place to add your middleware in a specific position"""
  36. # e.g. MIDDLEWARE.insert(0, 'your_plugin_type.plugin_name.middleware.YourMiddleware')
  37. pass
  38. @hookspec
  39. def get_AUTHENTICATION_BACKENDS():
  40. return [] # e.g. ['django_auth_ldap.backend.LDAPBackend']
  41. @hookspec
  42. def register_AUTHENTICATION_BACKENDS(AUTHENTICATION_BACKENDS):
  43. """Mutate AUTHENTICATION_BACKENDS in place to add your auth backends in a specific position"""
  44. # e.g. AUTHENTICATION_BACKENDS.insert(0, 'your_plugin_type.plugin_name.backend.YourBackend')
  45. pass
  46. @hookspec
  47. def get_DJANGO_HUEY_QUEUES():
  48. return [] # e.g. [{'name': 'your_plugin_type.plugin_name', 'HUEY': {...}}]
  49. @hookspec
  50. def register_DJANGO_HUEY(DJANGO_HUEY):
  51. """Mutate DJANGO_HUEY in place to add your huey queues in a specific position"""
  52. # e.g. DJANGO_HUEY['queues']['some_queue_name']['some_setting'] = 'some_value'
  53. pass
  54. @hookspec
  55. def get_ADMIN_DATA_VIEWS_URLS():
  56. return []
  57. @hookspec
  58. def register_ADMIN_DATA_VIEWS(ADMIN_DATA_VIEWS):
  59. """Mutate ADMIN_DATA_VIEWS in place to add your admin data views in a specific position"""
  60. # e.g. ADMIN_DATA_VIEWS['URLS'].insert(0, 'your_plugin_type/plugin_name/admin_data_views.py')
  61. pass
  62. @hookspec
  63. def register_settings(settings):
  64. """Mutate settings in place to add your settings / modify existing settings"""
  65. # settings.SOME_KEY = 'some_value'
  66. pass