Note that there are some explanatory texts on larger screens.

plurals
  1. POcan't include js file in pyramid project
    text
    copied!<p>I'm trying to use an external js file to use in my pyramid project. I found this solution but i can't seem to get it work. The js files i want to include are in C:\env\uza\uza\static\js project name = uza.</p> <p>In my template i use this to call the script:</p> <pre><code>&lt;script type="text/js" src="${request.static_url('uza:static/js/fabtabulous.js')}" /&gt; &lt;script type="text/js" src="${request.static_url('uza:static/js/tablekit.js')}" /&gt; </code></pre> <p>my init.py looks like this:</p> <pre><code>config.add_static_view('static', 'static', cache_max_age=3600) </code></pre> <p>When i navigate to the page in my browser it just gives me the pyramid sidebar in raw html code. I know it's a stupid mistake i made somewhere but i can't seem to find it. Is annyone able to help me with this.</p> <p><strong>EDIT:</strong> I uploaded a pdf to give a better understanding of the problem i'm having. ps: there are no errors in console. <a href="https://dl.dropboxusercontent.com/u/6752022/problem.pdf" rel="nofollow noreferrer">https://dl.dropboxusercontent.com/u/6752022/problem.pdf</a></p> <p><strong>EDIT:</strong> I made a new project using the sqlalchemy scaffold. The changes I made are: - include this line in the mytemplate.pt</p> <pre><code>&lt;script type="text/js" src="${request.static_url('javascript:static/js/tette.js')}" /&gt; &lt;input type="button" onclick="popup()" value="Click Me!"&gt; </code></pre> <p>- i didn't change annything else because i don't think anny other changes need to be made in the scaffold.</p> <ul> <li><p>my tette.js file looks like this:</p> <p>function popup() { alert("Hello World") }</p></li> </ul> <p>This is the output i have before including the js file. (deleted a few divs) <img src="https://i.stack.imgur.com/wVEGC.png" alt="enter image description here"></p> <p>And this is after. <img src="https://i.stack.imgur.com/NaYxE.png" alt="enter image description here"></p> <p>what am I doing wrong ? thanks in advance.</p>
 

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