Serving static files with Channels

84 views
Skip to first unread message

Alexander Prokhorov

unread,
May 12, 2017, 2:14:31 PM5/12/17
to Django developers (Contributions to Django itself)
Dear Colleagues,  in particular Andrew ;)

I have a problem with making Channels serve static files. The issue concerns running `./manage.py runworker` which (according to the Getting Started with Channels guide) serves static files if Django run in DEBUG mode. Actually, I would like to disable serving static files completely because I always use Whitenoise in both development mode and in production. Providing `--nostatic` to `runserver` command does the trick, but only if workers run in-process.
In my setup I separate server from workers, so I run server as `./manage.py runserver --nostatic --noworker` and run workers separately with `./manage.py runworker --only-channels...`. Unfortunately in this case workers continue serving static files if they run in DEBUG mode, but the whole point of `--nostatic` is to disable serving static even in DEBUG mode (in production mode it is disabled by default AFAIR).

Is there any workaround?


Andrew Godwin

unread,
May 12, 2017, 3:06:17 PM5/12/17
to Django developers (Contributions to Django itself)
Have you tried removing the staticfiles app from INSTALLED_APPS? I believe that will disable it even with runworker.

Andrew

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Prokhorov

unread,
May 12, 2017, 4:17:55 PM5/12/17
to Django developers (Contributions to Django itself)
Yes, that is obvious, forgot to mention this. I would be happy to get rid of staticfiles completely, but several Django apps we use depend on it. Namely "debug_toolbar" and "django_rest_framework". I suppose staticfiles declares some keywords for templates those apps use.



пятница, 12 мая 2017 г., 22:06:17 UTC+3 пользователь Andrew Godwin написал:
Have you tried removing the staticfiles app from INSTALLED_APPS? I believe that will disable it even with runworker.

Andrew
On Fri, May 12, 2017 at 11:14 AM, Alexander Prokhorov <pro...@gmail.com> wrote:
Dear Colleagues,  in particular Andrew ;)

I have a problem with making Channels serve static files. The issue concerns running `./manage.py runworker` which (according to the Getting Started with Channels guide) serves static files if Django run in DEBUG mode. Actually, I would like to disable serving static files completely because I always use Whitenoise in both development mode and in production. Providing `--nostatic` to `runserver` command does the trick, but only if workers run in-process.
In my setup I separate server from workers, so I run server as `./manage.py runserver --nostatic --noworker` and run workers separately with `./manage.py runworker --only-channels...`. Unfortunately in this case workers continue serving static files if they run in DEBUG mode, but the whole point of `--nostatic` is to disable serving static even in DEBUG mode (in production mode it is disabled by default AFAIR).

Is there any workaround?


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.

Andrew Godwin

unread,
May 12, 2017, 5:39:42 PM5/12/17
to Django developers (Contributions to Django itself)
Then I'm afraid you're stuck for now - you are welcome to open an issue against the Channels project to fix it and even write a patch if you want, but as DEBUG isn't turned on for production installs, it'll be considered a little lower priority.

Andrew

To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.

Alexander Prokhorov

unread,
May 13, 2017, 6:33:59 AM5/13/17
to Django developers (Contributions to Django itself)
Dear Andrew, that is clear. Thank you very much for quick response.

суббота, 13 мая 2017 г., 0:39:42 UTC+3 пользователь Andrew Godwin написал:
Then I'm afraid you're stuck for now - you are welcome to open an issue against the Channels project to fix it and even write a patch if you want, but as DEBUG isn't turned on for production installs, it'll be considered a little lower priority.

Andrew
On Fri, May 12, 2017 at 1:17 PM, Alexander Prokhorov <pro...@gmail.com> wrote:
Yes, that is obvious, forgot to mention this. I would be happy to get rid of staticfiles completely, but several Django apps we use depend on it. Namely "debug_toolbar" and "django_rest_framework". I suppose staticfiles declares some keywords for templates those apps use.



пятница, 12 мая 2017 г., 22:06:17 UTC+3 пользователь Andrew Godwin написал:
Have you tried removing the staticfiles app from INSTALLED_APPS? I believe that will disable it even with runworker.

Andrew

On Fri, May 12, 2017 at 11:14 AM, Alexander Prokhorov <pro...@gmail.com> wrote:
Dear Colleagues,  in particular Andrew ;)

I have a problem with making Channels serve static files. The issue concerns running `./manage.py runworker` which (according to the Getting Started with Channels guide) serves static files if Django run in DEBUG mode. Actually, I would like to disable serving static files completely because I always use Whitenoise in both development mode and in production. Providing `--nostatic` to `runserver` command does the trick, but only if workers run in-process.
In my setup I separate server from workers, so I run server as `./manage.py runserver --nostatic --noworker` and run workers separately with `./manage.py runworker --only-channels...`. Unfortunately in this case workers continue serving static files if they run in DEBUG mode, but the whole point of `--nostatic` is to disable serving static even in DEBUG mode (in production mode it is disabled by default AFAIR).

Is there any workaround?


--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
Reply all
Reply to author
Forward
0 new messages