Serving static files with Channels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Serving static files with Channels

Alexander Prokhorov
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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Serving static files with Channels

Andrew Godwin-3
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 <[hidden email]> 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 [hidden email].
To post to this group, send email to [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
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/CAFwN1uo-bvQxsOaRjk_uiSL2Vu%2B0ax%3DQy7w8cwsO_0kT8J4iRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Serving static files with Channels

Alexander Prokhorov
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="sz6hDtJRBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">pro...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="sz6hDtJRBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-develop...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="sz6hDtJRBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
Visit this group at <a href="https://groups.google.com/group/django-developers" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;">https://groups.google.com/group/django-developers.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
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/ac8eb115-71a6-4280-bec9-240f0df7e171%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Serving static files with Channels

Andrew Godwin-3
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 <[hidden email]> 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 <[hidden email]> 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 [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
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/ac8eb115-71a6-4280-bec9-240f0df7e171%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 [hidden email].
To post to this group, send email to [hidden email].
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/CAFwN1uqAi3t6eH47hPAhq1bG6hU7hnRDXtjK1aKggVtp%3DW6xrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Serving static files with Channels

Alexander Prokhorov
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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Kd9JWzFaBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">pro...@...> 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 <[hidden email]> 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 [hidden email].
Visit this group at <a href="https://groups.google.com/group/django-developers" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;">https://groups.google.com/group/django-developers.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-developers/e6a3cbb8-363d-415b-be61-610d9cc50f58%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Kd9JWzFaBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-develop...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Kd9JWzFaBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
Visit this group at <a href="https://groups.google.com/group/django-developers" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;">https://groups.google.com/group/django-developers.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-developers/ac8eb115-71a6-4280-bec9-240f0df7e171%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-developers/ac8eb115-71a6-4280-bec9-240f0df7e171%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-developers/ac8eb115-71a6-4280-bec9-240f0df7e171%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-developers/ac8eb115-71a6-4280-bec9-240f0df7e171%40googlegroups.com.

For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To post to this group, send email to [hidden email].
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/a528e98e-94db-4e20-8634-effa2347bd2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.