mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
Django 1.10: Upgrade urls of dev_urls.py.
This commit is contained in:
@@ -1,19 +1,21 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import os.path
|
import os.path
|
||||||
|
from django.views.static import serve
|
||||||
|
import zerver.views
|
||||||
|
|
||||||
# These URLs are available only in the development environment
|
# These URLs are available only in the development environment
|
||||||
|
|
||||||
use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False)
|
use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False)
|
||||||
static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static')
|
static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static')
|
||||||
|
|
||||||
urls = [url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': static_root})]
|
urls = [url(r'^static/(?P<path>.*)$', serve, {'document_root': static_root})]
|
||||||
i18n_urls = [url(r'^confirmation_key/$', 'zerver.views.confirmation_key')]
|
i18n_urls = [url(r'^confirmation_key/$', zerver.views.confirmation_key)]
|
||||||
|
|
||||||
# These are used for voyager development. On a real voyager instance,
|
# These are used for voyager development. On a real voyager instance,
|
||||||
# these files would be served by nginx.
|
# these files would be served by nginx.
|
||||||
if settings.LOCAL_UPLOADS_DIR is not None:
|
if settings.LOCAL_UPLOADS_DIR is not None:
|
||||||
urls += [
|
urls += [
|
||||||
url(r'^user_avatars/(?P<path>.*)$', 'django.views.static.serve',
|
url(r'^user_avatars/(?P<path>.*)$', serve,
|
||||||
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
|
{'document_root': os.path.join(settings.LOCAL_UPLOADS_DIR, "avatars")}),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user