Skip to content

Instantly share code, notes, and snippets.

@kjirou
Last active December 10, 2015 18:08
Show Gist options
  • Save kjirou/4472447 to your computer and use it in GitHub Desktop.
Save kjirou/4472447 to your computer and use it in GitHub Desktop.
DjangoでWebサーバが開発用か否かを判定したい
# 今は設定値にして、環境別に値を変えている
# 'development' or 'apache' or 'nginx'
WEB_SERVER = 'development'
if settings.DEBUG:
# こんな風に書きたいため
#if webserver_is_for_development is True:
urlpatterns += patterns('',
(
ur'^%s(?P<path>.*)$' % re.sub(ur'^/', u'', settings.MEDIA_URL),
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment