Django distributed memcached handling when server in cluster goes offline
I've got Django/memcached running in a 4 web server configuration on AWS. In settings.py each web server has (of course) a list of all the IPs participating in the memcached cluster. What I am noticing is when a server goes offline, all requests slow to a complete crawl presumably because Django/memcached is attempting to reference keys that has to the server that is down and is timing out. Is this expected behavior? If so how are others handling this? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8df76ae-6029-4dad-980c-06c4e93b4173%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)
Thank you. That is a perfect solution. On Wednesday, April 22, 2015 at 11:26:00 AM UTC-4, ke1g wrote: > > And I probably would have gone with: > > from django.conf import settings > if settings.DEBUG: > urlpatterns += patterns( > 'django.contrib.staticfiles.views', > url(r'^$', 'serve', kwargs={'path': 'index.html'}), > url(r'^(?P.*)$', 'serve'), > > The second url patter above must be the last one overall. Any of your > other patters, for you Django views, for example, have already not matched > by the time this one gets tried. > > > On Wed, Apr 22, 2015 at 11:17 AM, Bill Freeman <ke1...@gmail.com > > wrote: > >> By the way, you can test whether the regular expression matches without >> getting Django involved, allowing for much quicker theories and tests. >> >> $ python >> Python 2.7.3 (default, Jun 9 2014, 04:37:23) >> [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import re >> >>> re.match(r'^(?P(?:js|css|img)/.*)$', 'css/style.css') >> <_sre.SRE_Match object at 0x7fb34977ddc8> >> >>> _.groups() >> ('css/style.css',) >> >>> re.match(r'^(?P(?:js|css|img)/.*)$', 'apps/css/style.css') # >> Does not match >> >>> re.match(r'^(?P(?:js|css|img)/.*)$', 'apps/another.html')# >> Does not match >> >>> re.match(r'^(?P(?:apps|js|css|img)/.*)$', 'apps/another.html') >> <_sre.SRE_Match object at 0x7fb34977ddc8> >> >>> _.groups() >> ('apps/another.html',) >> >>> >> >> On Wed, Apr 22, 2015 at 11:06 AM, Bill Freeman <ke1...@gmail.com >> > wrote: >> >>> Are css and js subdirectries of apps as implied by the (as received) >>> indentation of your message? Note that your "other" url pattern has js, >>> css, and img, but no apps. >>> >>> On Wed, Apr 22, 2015 at 9:28 AM, LiteWait <t...@toogopos.com >>> > wrote: >>> >>>> Well, this doesn't work completely. >>>> >>>> Consider the (static) tree: >>>> >>>> /client >>>> index.html >>>> /apps >>>> another.html >>>> /css >>>> style.css >>>> /js >>>> my.js >>>> >>>> I need to serve this whole static tree out of /. >>>> >>>> >>>> On Tuesday, April 21, 2015 at 10:08:26 PM UTC-4, LiteWait wrote: >>>>> >>>>> I have no clue why this works, but I added the /client directory (full >>>>> path) to STATICFILE_DIRS and... >>>>> >>>>> from django.conf import settings >>>>> if settings.DEBUG: >>>>> urlpatterns += patterns( >>>>> 'django.contrib.staticfiles.views', >>>>> url(r'^(?:index.html)?$', 'serve', kwargs={'path': 'index.html'}), >>>>> url(r'^(?P(?:js|css|img)/.*)$', 'serve'), >>>>> >>>>> >>>>> Now /client/index.html is served up fine, as well as Django normal routes >>>>> like /admin, /api, etc. I really wish I understood this better. >>>>> >>>>> >>>>> >>>>> On Tuesday, April 21, 2015 at 4:02:24 PM UTC-4, ke1g wrote: >>>>>> >>>>>> That may work for most static things. The question is whether the >>>>>> static server is happy with an empty path, assuming that you're trying >>>>>> to >>>>>> serve "/" this way. If not, you might add a separate (earlier) pattern >>>>>> of >>>>>> r'^$' that specifies a path in the extra parameters dictionary (where >>>>>> you >>>>>> have 'document_root', and you may want it's document_root to be >>>>>> different >>>>>> to avoid serving the home page at two urls). >>>>>> >>>>>> On Tue, Apr 21, 2015 at 1:56 PM, LiteWait <t...@toogopos.com> wrote: >>>>>> >>>>>>> Planning to host the client side of our application in production >>>>>>> from a proxy to an S3 site from Nginx. >>>>>>> >>>>>>> The problem is we'd like to mimic this behavior by serving / in >>>>>>> Django runser
Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)
Well, this doesn't work completely. Consider the (static) tree: /client index.html /apps another.html /css style.css /js my.js I need to serve this whole static tree out of /. On Tuesday, April 21, 2015 at 10:08:26 PM UTC-4, LiteWait wrote: > > I have no clue why this works, but I added the /client directory (full > path) to STATICFILE_DIRS and... > > from django.conf import settings > if settings.DEBUG: > urlpatterns += patterns( > 'django.contrib.staticfiles.views', > url(r'^(?:index.html)?$', 'serve', kwargs={'path': 'index.html'}), > url(r'^(?P(?:js|css|img)/.*)$', 'serve'), > > > Now /client/index.html is served up fine, as well as Django normal routes > like /admin, /api, etc. I really wish I understood this better. > > > > On Tuesday, April 21, 2015 at 4:02:24 PM UTC-4, ke1g wrote: >> >> That may work for most static things. The question is whether the static >> server is happy with an empty path, assuming that you're trying to serve >> "/" this way. If not, you might add a separate (earlier) pattern of r'^$' >> that specifies a path in the extra parameters dictionary (where you have >> 'document_root', and you may want it's document_root to be different to >> avoid serving the home page at two urls). >> >> On Tue, Apr 21, 2015 at 1:56 PM, LiteWait <t...@toogopos.com> wrote: >> >>> Planning to host the client side of our application in production from a >>> proxy to an S3 site from Nginx. >>> >>> The problem is we'd like to mimic this behavior by serving / in Django >>> runserver using a static directory url() entry. >>> >>> I've read over >>> https://docs.djangoproject.com/en/1.4/howto/static-files/#serving-other-directories >>> but >>> I can't seem to make Django route / to my client directory. >>> >>> Idea is I have a project directory* /client *which contains index.html >>> along with all the other files for site, and when I hit >>> http://127.0.0.1:8000/ I want to serve up >>> */client/index.html.* >>> >>> Not sure the following will work because I don't think you can't have a >>> STATIC_URL = '/', right? >>> >>> from django.contrib.staticfiles.urls import staticfiles_urlpatterns >>> urlpatterns += staticfiles_urlpatterns() >>> >>> >>> This one seems to make more sense, but I am not clear on what URL >>> pattern could pull this off.. >>> >>> if settings.DEBUG: >>> urlpatterns += patterns('', >>> url(r'^(?P.*)$', 'django.views.static.serve', {'document_root': >>> '/client',}), >>> ) >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-users...@googlegroups.com. >>> To post to this group, send email to django...@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/ffdc58f3-e10c-46df-b14f-ec4bc02c0c70%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/django-users/ffdc58f3-e10c-46df-b14f-ec4bc02c0c70%40googlegroups.com?utm_medium=email_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5ba4b639-48df-4c3b-8fb8-00a1a166f58e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)
I have no clue why this works, but I added the /client directory (full path) to STATICFILE_DIRS and... from django.conf import settings if settings.DEBUG: urlpatterns += patterns( 'django.contrib.staticfiles.views', url(r'^(?:index.html)?$', 'serve', kwargs={'path': 'index.html'}), url(r'^(?P(?:js|css|img)/.*)$', 'serve'), Now /client/index.html is served up fine, as well as Django normal routes like /admin, /api, etc. I really wish I understood this better. On Tuesday, April 21, 2015 at 4:02:24 PM UTC-4, ke1g wrote: > > That may work for most static things. The question is whether the static > server is happy with an empty path, assuming that you're trying to serve > "/" this way. If not, you might add a separate (earlier) pattern of r'^$' > that specifies a path in the extra parameters dictionary (where you have > 'document_root', and you may want it's document_root to be different to > avoid serving the home page at two urls). > > On Tue, Apr 21, 2015 at 1:56 PM, LiteWait <t...@toogopos.com > > wrote: > >> Planning to host the client side of our application in production from a >> proxy to an S3 site from Nginx. >> >> The problem is we'd like to mimic this behavior by serving / in Django >> runserver using a static directory url() entry. >> >> I've read over >> https://docs.djangoproject.com/en/1.4/howto/static-files/#serving-other-directories >> but >> I can't seem to make Django route / to my client directory. >> >> Idea is I have a project directory* /client *which contains index.html >> along with all the other files for site, and when I hit >> http://127.0.0.1:8000/ I want to serve up >> */client/index.html.* >> >> Not sure the following will work because I don't think you can't have a >> STATIC_URL = '/', right? >> >> from django.contrib.staticfiles.urls import staticfiles_urlpatterns >> urlpatterns += staticfiles_urlpatterns() >> >> >> This one seems to make more sense, but I am not clear on what URL pattern >> could pull this off.. >> >> if settings.DEBUG: >> urlpatterns += patterns('', >> url(r'^(?P.*)$', 'django.views.static.serve', {'document_root': >> '/client',}), >> ) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users...@googlegroups.com . >> To post to this group, send email to django...@googlegroups.com >> . >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/ffdc58f3-e10c-46df-b14f-ec4bc02c0c70%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/ffdc58f3-e10c-46df-b14f-ec4bc02c0c70%40googlegroups.com?utm_medium=email_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2b6ca9b8-2366-43ce-84a9-0c40a0bee9d6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Runserver/DEBUG only, serve / from static directory
I have the need in runserver/debug mode to map http://127.0.0.1:8000/ out of a static /client directory. Django will only serve up pages from /api which a DRF REST services. I can't seem to find a way to create the URL mapping for this. It seems https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-during-development describes how to do this but the URL pattern escapes me. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1d9cb2c6-7419-42a9-ad53-74fde9285c5d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)
Planning to host the client side of our application in production from a proxy to an S3 site from Nginx. The problem is we'd like to mimic this behavior by serving / in Django runserver using a static directory url() entry. I've read over https://docs.djangoproject.com/en/1.4/howto/static-files/#serving-other-directories but I can't seem to make Django route / to my client directory. Idea is I have a project directory* /client *which contains index.html along with all the other files for site, and when I hit http://127.0.0.1:8000/ I want to serve up */client/index.html.* Not sure the following will work because I don't think you can't have a STATIC_URL = '/', right? from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns() This one seems to make more sense, but I am not clear on what URL pattern could pull this off.. if settings.DEBUG: urlpatterns += patterns('', url(r'^(?P.*)$', 'django.views.static.serve', {'document_root': '/client',}), ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ffdc58f3-e10c-46df-b14f-ec4bc02c0c70%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
simple translation not working
Django 1.5 I am just testing that translation is working. I generated /locale/es/LC_MESSAGES/django.po|mo I added LOCALE_PATHS as 'locale' I set my LANGUAGE_CODE = "es-ES" Admin site is in Spanish, however my translations are not working. What am I missing here? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/40ff0635-5669-4473-8eed-c5a563c4eb27%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.