2016-06-25 03:44:32 +02:00
|
|
|
from django.conf.urls import url
|
|
|
|
from django.conf import settings
|
2017-06-14 02:01:01 +02:00
|
|
|
from django.views.generic import TemplateView
|
2016-06-25 03:44:32 +02:00
|
|
|
import os.path
|
2016-10-27 13:29:44 +02:00
|
|
|
from django.views.static import serve
|
2017-01-07 21:46:03 +01:00
|
|
|
import zerver.views.registration
|
2017-03-18 01:58:45 +01:00
|
|
|
import zerver.views.auth
|
2017-06-08 02:47:44 +02:00
|
|
|
import zerver.views.test_emails
|
2016-06-25 03:44:32 +02:00
|
|
|
|
|
|
|
# These URLs are available only in the development environment
|
|
|
|
|
2016-07-04 09:33:57 +02:00
|
|
|
use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False)
|
2016-06-25 03:44:32 +02:00
|
|
|
static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static')
|
|
|
|
|
2017-03-18 01:58:45 +01:00
|
|
|
urls = [
|
2017-06-02 21:44:09 +02:00
|
|
|
# Serve static assets via the Django server
|
|
|
|
url(r'^static/(?P<path>.*)$', serve, {'document_root': static_root}),
|
|
|
|
|
|
|
|
# Serve useful development environment resources (docs, coverage reports, etc.)
|
2017-03-23 19:59:24 +01:00
|
|
|
url(r'^coverage/(?P<path>.*)$',
|
|
|
|
serve, {'document_root':
|
|
|
|
os.path.join(settings.DEPLOY_ROOT, 'var/coverage'),
|
|
|
|
'show_indexes': True}),
|
2017-06-09 07:17:00 +02:00
|
|
|
url(r'^node-coverage/(?P<path>.*)$',
|
|
|
|
serve, {'document_root':
|
|
|
|
os.path.join(settings.DEPLOY_ROOT, 'var/node-coverage/lcov-report'),
|
|
|
|
'show_indexes': True}),
|
2017-03-23 19:59:24 +01:00
|
|
|
url(r'^docs/(?P<path>.*)$',
|
|
|
|
serve, {'document_root':
|
|
|
|
os.path.join(settings.DEPLOY_ROOT, 'docs/_build/html')}),
|
2017-06-02 21:44:09 +02:00
|
|
|
|
|
|
|
# The special no-password login endpoint for development
|
2017-03-18 01:58:45 +01:00
|
|
|
url(r'^devlogin/$', zerver.views.auth.login_page,
|
|
|
|
{'template_name': 'zerver/dev_login.html'}, name='zerver.views.auth.login_page'),
|
2017-06-08 02:47:44 +02:00
|
|
|
|
|
|
|
# Page for testing email templates
|
|
|
|
url(r'^emails/$', zerver.views.test_emails.email_page),
|
2017-06-14 02:01:01 +02:00
|
|
|
|
|
|
|
# Listing of useful URLs and various tools for development
|
|
|
|
url(r'^devtools/$', TemplateView.as_view(template_name='zerver/dev_tools.html')),
|
2017-06-15 05:42:27 +02:00
|
|
|
|
|
|
|
# Have easy access for error pages
|
|
|
|
url(r'^errors/404/$', TemplateView.as_view(template_name='404.html')),
|
|
|
|
url(r'^errors/5xx/$', TemplateView.as_view(template_name='500.html')),
|
2017-03-18 01:58:45 +01:00
|
|
|
]
|
2017-03-23 19:59:24 +01:00
|
|
|
|
2017-03-18 01:58:45 +01:00
|
|
|
i18n_urls = [
|
|
|
|
url(r'^confirmation_key/$', zerver.views.registration.confirmation_key),
|
|
|
|
]
|
2016-06-25 03:44:32 +02:00
|
|
|
|
|
|
|
# These are used for voyager development. On a real voyager instance,
|
|
|
|
# these files would be served by nginx.
|
|
|
|
if settings.LOCAL_UPLOADS_DIR is not None:
|
|
|
|
urls += [
|
2016-10-27 13:29:44 +02:00
|
|
|
url(r'^user_avatars/(?P<path>.*)$', serve,
|
2016-06-25 03:44:32 +02:00
|
|
|
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
|
|
|
|
]
|