Channels: Sometimes Django throws 404 error

Created on 12 Apr 2016  路  9Comments  路  Source: django/channels

After upgrading to the latest I got strange issue "static files not loading correctly". I have whitenoise setup correctly...

pip freeze

asgi-redis==0.10.0
asgiref==0.11.2
autobahn==0.13.1
channels==0.11.0
daphne==0.10.3
Django==1.9.5
django-reversion==1.10.1
django-reversion-compare==0.6.1
djangorestframework==3.3.3
gitdb==0.6.4
GitPython==1.0.2
gunicorn==19.4.5
msgpack-python==0.4.7
psycopg2==2.6.1
pytz==2016.3
redis==2.10.5
requests==2.9.1
six==1.10.0
smmap==0.9.0
Twisted==16.1.1
txaio==2.3.1
whitenoise==3.0
zope.interface==4.1.3

Output of runserver...

[2016/04/12 17:54:57] HTTP GET /static/css/bootstrap.min.css 304 [0.05, 127.0.0.1:46579]
[2016/04/12 17:54:58] HTTP GET /static/css/bootstrap.min.css 304 [0.04, 127.0.0.1:46579]
[2016/04/12 17:54:58] HTTP GET /static/css/bootstrap.min.css 304 [0.03, 127.0.0.1:46579]
[2016/04/12 17:54:58] HTTP GET /static/css/bootstrap.min.css 304 [0.03, 127.0.0.1:46579]
[2016/04/12 17:54:59] HTTP GET /static/css/bootstrap.min.css 404 [0.03, 127.0.0.1:46579]
[2016/04/12 17:54:59] HTTP GET /static/css/bootstrap.min.css 200 [0.02, 127.0.0.1:46579]
[2016/04/12 17:54:59] HTTP GET /static/css/bootstrap.min.css 304 [0.02, 127.0.0.1:46579]
[2016/04/12 17:55:00] HTTP GET /static/css/bootstrap.min.css 304 [0.01, 127.0.0.1:46579]
[2016/04/12 17:55:00] HTTP GET /static/css/bootstrap.min.css 304 [0.02, 127.0.0.1:46579]
[2016/04/12 17:55:00] HTTP GET /static/css/bootstrap.min.css 404 [0.01, 127.0.0.1:46579]
[2016/04/12 17:55:01] HTTP GET /static/css/bootstrap.min.css 200 [0.03, 127.0.0.1:46579]
[2016/04/12 17:55:01] HTTP GET /static/css/bootstrap.min.css 304 [0.03, 127.0.0.1:46579]
[2016/04/12 17:55:01] HTTP GET /static/css/bootstrap.min.css 304 [0.04, 127.0.0.1:46579]
[2016/04/12 17:55:01] HTTP GET /static/css/bootstrap.min.css 304 [0.01, 127.0.0.1:46579]
[2016/04/12 17:55:02] HTTP GET /static/css/bootstrap.min.css 404 [0.04, 127.0.0.1:46579]
[2016/04/12 17:55:02] HTTP GET /static/css/bootstrap.min.css 200 [0.01, 127.0.0.1:46579]
[2016/04/12 17:55:02] HTTP GET /static/css/bootstrap.min.css 304 [0.02, 127.0.0.1:46579]
[2016/04/12 17:55:02] HTTP GET /static/css/bootstrap.min.css 304 [0.04, 127.0.0.1:46579]
[2016/04/12 17:55:03] HTTP GET /static/css/bootstrap.min.css 304 [0.04, 127.0.0.1:46579]
[2016/04/12 17:55:03] HTTP GET /static/css/bootstrap.min.css 404 [0.03, 127.0.0.1:46579]
[2016/04/12 17:55:03] HTTP GET /static/css/bootstrap.min.css 200 [0.03, 127.0.0.1:46579]
[2016/04/12 17:55:03] HTTP GET /static/css/bootstrap.min.css 304 [0.03, 127.0.0.1:46579]
[2016/04/12 17:55:03] HTTP GET /static/css/bootstrap.min.css 304 [0.04, 127.0.0.1:46579]
[2016/04/12 17:55:04] HTTP GET /static/css/bootstrap.min.css 304 [0.01, 127.0.0.1:46579]
[2016/04/12 17:55:04] HTTP GET /static/css/bootstrap.min.css 404 [0.02, 127.0.0.1:46579]

Most helpful comment

When using python manage.py runserver --noasgi command the above error not producing.

All 9 comments

When using python manage.py runserver --noasgi command the above error not producing.

+1
how to fix it?

I think the recent version doesn't produce above error. But I'm running without ./manage.py worker and everything seems working fine...

this happens when I start server with _--noworker_ option
./manage.py runserver --noworker localhost

Yes, this is likely fixed in the most recent version - looks like this issue didn't make it to my inbox before as it triggered my "django error email" filter (sorry!) Closing for now.

If you start a server with --noworker, too, you'll need to start a worker with manage.py runworker as well.

I started manage.py runworker too. But this error always appears.

Fix 404 errors by this.

I am having 404 errors when using runserver after installing channels. I have the 404 error even in the admin page from the contrib modules. If I disable channels from the INSTALLED_APPS then it works fine. I am using channels version 1.0.2.

Using the fix suggested by @onegreyonewhite did not solve it.

@javiermatos please submit your settings here and describe the way you running channels. Also consider opening new issue rather discussing in the closed one.

Was this page helpful?
0 / 5 - 0 ratings