javascript - can't include js file in pyramid project -
i'm trying use external js file use in pyramid project. found solution can't seem work. js files want include in c:\env\uza\uza\static\js project name = uza.
in template use call script:
<script type="text/js" src="${request.static_url('uza:static/js/fabtabulous.js')}" /> <script type="text/js" src="${request.static_url('uza:static/js/tablekit.js')}" />
my init.py looks this:
config.add_static_view('static', 'static', cache_max_age=3600)
when navigate page in browser gives me pyramid sidebar in raw html code. know it's stupid mistake made somewhere can't seem find it. annyone able me this.
edit: uploaded pdf give better understanding of problem i'm having. ps: there no errors in console. https://dl.dropboxusercontent.com/u/6752022/problem.pdf
edit: made new project using sqlalchemy scaffold. changes made are: - include line in mytemplate.pt
<script type="text/js" src="${request.static_url('javascript:static/js/tette.js')}" /> <input type="button" onclick="popup()" value="click me!">
- didn't change annything else because don't think anny other changes need made in scaffold.
my tette.js file looks this:
function popup() { alert("hello world") }
this output have before including js file. (deleted few divs)
and after.
what doing wrong ? in advance.
can out point pyramid sidebar looks , works correctly, , isn't raw html?
your init.py line looks correct. in templates can @ whatever in 'static' folder so:
<link rel="stylesheet" href="${request.static_url('myproject:static/style.css')}"> <!--[if lte ie 6]> <link rel="stylesheet" href="${request.static_url('myproject:static/ie6.css')}" type="text/css" media="screen" charset="utf-8"/> <![endif]--> <script type="text/javascript" src="${request.static_url('myproject:static/tinymce/jscripts/tiny_mce/tiny_mce.js')}"></script>