Question

I'm developing a game in Cocos2d-JS with a Django backend. And, I'm getting this error in Chrome Console:

GET http://127.0.0.1:8000/Users/filipefr/Documents/appname/appname/static/static/js/Platform/HTML5/cocos2d/platform/jsloader.js 404 (NOT FOUND) 

Although I already checked, and jsloader exists in this Folder.

In Mac Terminal, I'm getting this error:

"GET /Users/filipefr/Documents/appname/appname/static/static/js/Platform/HTML5/cocos2d/platform/jsloader.js HTTP/1.1" 404 2461
Was it helpful?

Solution

You're using an absolute path. You should use a relative path. Check you settings.py, you should have this:

import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),
)

And then on your urls.py you should have this:

url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
             'document_root': settings.MEDIA_ROOT,
}),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top