Load jQuery into Django

前端 未结 5 907
后悔当初
后悔当初 2021-01-14 05:56

I have a really basic question. I\'m trying to build some AJAX functionality into a Django project. I plan to use jQuery. Right now, I\'m just running the code locally th

5条回答
  •  轮回少年
    2021-01-14 06:35

    You need to setup Django to serve your media files (otherwise, serve them from a proper HTTP server). Add the following line to your url.py:

    (r'^mymedia/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    

    Make sure you change the mymedia part to align with your media directory.

提交回复
热议问题