Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8639885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:08:12+00:00 2026-06-12T11:08:12+00:00

I am trying to get jquery.raty working with Django. I have the serving of

  • 0

I am trying to get jquery.raty working with Django. I have the serving of static-files perfectly setup, however it seems it has a problem finding the rating image files after all.

This is how I have set it up:

base.html (static loads here fine)

<script src="{{ STATIC_URL }}raty/js/jquery.raty.min.js"></script>

template:

<div id="star"></div>

js

$('#star').raty({
      cancel    : true,
      cancelOff : 'cancel-off-big.png',
      cancelOn  : 'cancel-on-big.png',
      half      : true,
      size      : 24,
      starHalf  : 'star-half-big.png',
      starOff   : 'star-off-big.png',
      starOn    : 'star-on-big.png'
    });

but instead of stars I see alternate text numbers:

enter image description here

And this is the message I get from server when refreshing the page:

[07/Oct/2012 21:03:48] "GET /contact/add/img/star-off-big.png HTTP/1.1" 200 9941

I don’t understand why it looks at current location (http://127.0.0.1:8000/contact/add/) and appends /img/xxx.png to the /contact/add/.

How do I set the path to the images in the javascript using a STATIC_URL path?

Would really appreciate your help on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:08:13+00:00Added an answer on June 12, 2026 at 11:08 am

    The default path of Raty is “img”. Try passing path as an absolute URL:

    $('#star').raty({
        cancel    : true,
        cancelOff : 'cancel-off-big.png',
        cancelOn  : 'cancel-on-big.png',
        half      : true,
        size      : 24,
        starHalf  : '../raty/img/star-half-big.png',
        starOff   : 'star-off-big.png',
        starOn    : 'star-on-big.png',
        path      : '{{ STATIC_URL }}img' // <-- or wherever your raty images are
    });
    

    Edit:

    One way using jQuery “namespaced” variables for using STATIC_URL in other external javascript files. This would be defined in the <head> of your template, after including jQuery but before any scripts which used the defined variable.

    <script type="text/javascript">  
        $.myproject = {} // namespace
        $.myproject.STATIC_URL = '{{ STATIC_URL }}';
    </script>
    

    Then your other scripts can use $.myproject.STATIC_URL when the absolute URL to the static assets is needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get JQuery Sortable working on my Zend Framework application
I'm trying to get jQuery range slider working with jQuery Mobile but it seems
I'm TRYING to get jQuery .get to work. I have two files. I. Where
I have two columns, each with many rows/divs. I'm trying to get jQuery UI
I'm trying to get jquery intellisense working per the instructions here: http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx#7117822 I'm not
I'm creating a new web project and i trying to get jQuery working with
Been trying to get the Jquery plugin Easy Slider 1.7 working. been messing about
I am trying to get the jQuery validation working on a webpage I am
I'm trying to get jQuery validate to work with my radio button form. However,
I am trying to get Jquery intellisense working in Visual Studio 2010. I've looked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.