views:

46

answers:

1

Hey,

When this one runs everything goes fine:

(r"^newobject$", "views.myobjects.newobject"),

All the CSS + JS files are properly fetched from:

static/css/...
static/js/...

When this one runs:

(r"^mybjects/(([a-z]|[A-Z]|[0-9])+)$","views.myobjects.loadobject"),

All the css and JS files that are being fetched, are run trough the urlpatterns and are returning my defailt page:

(r"", 'views.main.index'),

This makes all my CSS and JS code to actualy be HTML. My guess is that i'm giving some noob mistake. Is there any common reason why this should happen? And how to fix it?

Edit:

Css example:

<link href="static/css/style.css" type="text/css" rel="stylesheet">

JS example:

<script src="static/js/libs/date.js" type="text/javascript"></script>
+2  A: 

See the difference:

  • when you access *some url*/newobject the static/css/style.css refers *some url*/static/css/style.css*
  • when you access *some url*/newobject/whatever the static/css/style.css refers *some url*/newobject/static/css/style.css*

If your URL will always be floating around in depth, include your javascript and CSS using URLs relative to the server root (start them by /) instead of relative to the current dir.

Miguel Ventura
obrigadão era mesmo isso ;)
fmsf