Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread LiteWait
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'^$',

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
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

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
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" fo

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread Bill Freeman
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 wrote: > Well, this doesn't work completely. > > Consider the (static) tree: > > /cli

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-22 Thread LiteWait
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

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-21 Thread LiteWait
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.htm

Re: Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-21 Thread Bill Freeman
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 'doc

Serving / out of static directory, /api for Django DRF services (development/runserver/DEBUG mode)

2015-04-21 Thread LiteWait
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-file