Last active
December 10, 2015 18:08
-
-
Save kjirou/4472447 to your computer and use it in GitHub Desktop.
DjangoでWebサーバが開発用か否かを判定したい
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 今は設定値にして、環境別に値を変えている | |
# 'development' or 'apache' or 'nginx' | |
WEB_SERVER = 'development' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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