Automate inclusion of urls.py files for EXTRA_INSTALLED_APPS.

By removing this hardcoding of the list of valid extra apps, we make
it a lot easier to add additional pluggable apps to the Zulip
codebase.
This commit is contained in:
Tim Abbott 2016-04-26 21:39:34 -07:00
parent bf50dd7771
commit 8905216df5
2 changed files with 8 additions and 12 deletions

View File

@ -127,4 +127,5 @@ ADMINS = (
EXTRA_INSTALLED_APPS = [
'analytics',
'zilencer',
'corporate',
]

View File

@ -261,19 +261,14 @@ v1_api_and_json_patterns = patterns('zerver.views',
{'GET': 'get_events_backend',
'DELETE': 'cleanup_event_queue'}),
)
if not settings.VOYAGER:
urlpatterns += patterns('',
url(r'^', include('zilencer.urls')),
)
urlpatterns += patterns('',
url(r'^', include('analytics.urls')),
)
urlpatterns += patterns('',
url(r'^', include('corporate.urls')),
)
# Include URL configuration files for site-specified extra installed
# Django apps
for app_name in settings.EXTRA_INSTALLED_APPS:
app_dir = os.path.join(settings.DEPLOY_ROOT, app_name)
if os.path.exists(os.path.join(app_dir, 'urls.py')):
urlpatterns += patterns('', url(r'^', include('%s.urls' % (app_name,))),
)
urlpatterns += patterns('zerver.tornadoviews',
# Tornado views