0

I'm working fine with dajaxice.

Now, I want to use dajax. I installed it, and I put

<script type="text/javascript" src="{% static 'dajax/jquery.core.js' %}"></script>

that line is changed as

<script type="text/javascript" src="/static/dajax/jquery.core.js"></script>

But there is no js file in that location.

Did I missed somthing? where is usually that js file?

I think this is caused by url.py setting, since if I check that url, I can see url error page from django.

--- edited

When I run -- manage.py collectstatic -- following is log.

You have requested to collect static files at the destination
location as specified in your settings.

This will overwrite existing files!
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Copying '/var/folders/8w/w7cl5wvx1kvd1vkgz83179j00000gn/T/tmpXouwqg'

1 static file copied, 79 unmodified.

In my opinion, 1 static file is just dajaxice file, not dajax file. ( I vi-ed that file )

JD Yang
  • 371
  • 2
  • 3
  • 16
  • Did you run `./manage.py collectstatic` ? – jpic Nov 19 '12 at 14:16
  • 1
    `collectstatic` populates STATIC_ROOT for the HTTP server, which should serve STATIC_ROOT on STATIC_URL. Django devserver does **not** need `collectstatic`. It seems like you are confused by static files, here's an [article that aims at being more pedagogic than the documentation](http://blog.yourlabs.org/post/30382323418/surviving-django-contrib-staticfiles-or-how-to-manage). Did you try `findstatic` too ? – jpic Nov 19 '12 at 14:49
  • Thank you jpic. Maybe the dajax file is /project_name/dajax/jquery.dajax.core.js , so I decided copy that file to my STATIC_ROOT. I dunno this works well, but will try. – JD Yang Nov 19 '12 at 15:13
  • Maybe you didn't add dajax to `settings.INSTALLED_APPS` – jpic Nov 19 '12 at 15:49

2 Answers2

0

By default, Django will not serve static files unless it is in debug mode (in settings.py, set DEBUG=True, setting this will have a series of other insecure implications). However, it provides you a management command for you to collect the static files to a central location (./manage.py collectstatic), then you could configure your web server to serve those files directly, without going through the Django framework.

The collectstatic command will collect the static files from all the apps installed (and any files specified in the settings STATICFILES_DIRS) to the directory specified in STATIC_ROOT, assuming that the URL as the setting STATIC_URL.

For more information, please take a look on these pages from Django document: https://docs.djangoproject.com/en/1.3/howto/static-files

https://docs.djangoproject.com/en/1.3/ref/contrib/staticfiles/

Raymond Tau
  • 3,429
  • 26
  • 28
  • I tried it. then, I can see ' 1 static file copied ' message. why it is not 2 file? (I think I need djaxice file and dajax file). I checked that copied file, which my ajax source is in. My js can not load 'Dajax.process' still now :( – JD Yang Nov 19 '12 at 14:40
0

I answered myself.

Dajax document is not currently supported and not updated.

The dajax file is not 'jquery.js' or somthing, it is, jquery.dajax.core.js.

I googled and found many programmer asked about it, but no answer.

Checking dajax directory in project App, then you will find jquery.dajax.core.js file.

Not jquery.core.js as dajax document said.

JD Yang
  • 371
  • 2
  • 3
  • 16