Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to include css/javascript in django 0.96 for appengine project
    text
    copied!<p>I am using django 0.96 for the appengine project. I wanted to use javascript and css in my html files unfortunately i am unable to do it via django... One solution(which i don't like) is to make my app.yaml something like this:</p> <pre><code>handlers: - url: /media static_dir: static/media </code></pre> <p>But i want it to do with django itself so i avoided using the above line and hence am seeking a "django" way of doing it. The directory structure of my project is like(not complete just the relevants project /myapp /static /media /css /js /images settings.py app.yaml</p> <p>and a sample template file header is:</p> <pre><code>&lt;link type="text/css" href="/media/css/ui-lightness/jquery-ui-1.7.1.custom.css" rel="Stylesheet" /&gt; &lt;script type="text/javascript" src="/media/js/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/media/js/jquery-ui-1.7.1.custom.min.js"&gt;$('#date').datepicker();&lt;/script&gt; </code></pre> <p>the settings.py has:</p> <pre><code>MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'static') MEDIA_URL ='/media/' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os.path.join(os.path.dirname(__file__), 'myapp/templates'), os.path.join(os.path.dirname(__file__), 'static'), ) </code></pre> <p>I know i am making a mistake in the headers or setting because when i use absolute url like:</p> <blockquote> <p> then atleast the css works. The solution exists to do it with app.yaml(as i mentioned above) but i wanted to do it from django itself. Any hints? Thanks</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload