Sunday, June 30, 2013

dajaxice file cannot be found

I am usering django_dajax 0.9.2 and django_dajaxice 0.5.5 for my current project. This is how I configure it


#settings.py

MAIN_DIR = os.path.dirname(__file__)
PROJECT_DIR = MAIN_DIR.rsplit(os.sep, 1)[0]

# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.join(PROJECT_DIR, 'static')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(MAIN_DIR, 'static'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'dajaxice.finders.DajaxiceFinder',
)


and my urls.py

from dajaxice.core import dajaxice_autodiscover, dajaxice_config
dajaxice_autodiscover()

if settings.DEBUG:
    urlpatterns = patterns('',
        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    )

urlpatterns += patterns('',
    url(dajaxice_config.dajaxice_url, include('dajaxice.urls')),
    .......



With this settings, I am enable to use these libs in my local machine. However, when deploying to the client machine, the file dajaxice.core.js cannot be found (see it on firebug). When use python manage.py collecstatic, I see that that file is saved into the folder temp (Copying '/tmp/tmpsiiuMx'). The rendered link is correct

<script src="/static/dajaxice/dajaxice.core.js" type="text/javascript" charset="utf-8"></script>
and there is indeed that file under the /static/dajaxice folder, but still the browser complains about cannot find that file. Do you have any idea about this ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment