1

I'm using Backbone and Django in a project. Initially I wanted to use Backbone views throughout the site to render my HTML content, however, there was a CRUD page that required FILE uploads and stuff so I decided to use the Django to render the site.

Now, since the form is at the url /item/article/new (http://localhost/item/article/new/), when I load up the page, it is unable to locate the requirejs dependency as stated in the config.js file. Just so that it's clear, the require.js script tag is like such:

<script src="{{ STATIC_URL }}js/libs/require/require-jquery.min.js" data-main="{{ STATIC_URL }}js/config"></script>

My config.js file:

require.config({

  // Set base url for paths to reference
  baseUrl: 'static/js',

  // Initialize the application with the main application file.
  deps: ['main'],
  paths: {
    jquery: 'libs/require/require-jquery.min',
    ...
    ...
  }
})

Now, since my baseUrl is set to static/js, when I navigate to /item/article/new, it complains that it could not find http://localhost/item/article/new/static/js/main.js.

What do I need to do to fix this?

Thanks in advance!

Mark
  • 2,137
  • 4
  • 27
  • 42

1 Answers1

2

Try appending forward slash at start to your baseUrl /static/js

Aamir Rind
  • 38,793
  • 23
  • 126
  • 164
  • Thanks a lot! Couldn't find what I was doing wrong and your answer helped me! But why does it depend on the slash so heavily? – Dmitry Wojciechowski Jun 06 '13 at 04:02
  • 1
    @DmitryWojciechowski see [here](http://stackoverflow.com/questions/10659459/starting-with-a-forward-slash-in-html-for-href) this will clarify your confusion. – Aamir Rind Jun 06 '13 at 08:35