librelist archives

« back to archive

javascript in static 404 not found

javascript in static 404 not found

From:
arief nur andono
Date:
2011-02-07 @ 10:09
hi this is myapp folder structure like

http://flask.pocoo.org/mailinglist/archive/2011/1/25/problems-with-modules-urls-and-method-names

~/flask $ tree myapp/

myapp/
|-- apps
|   |-- audience
|   |   |-- __init__.py
|   |   |-- __init__.pyc
|   |   |-- static
|   |   |   `-- chatbox.js
|   |   |-- templates
|   |   |   `-- index.html
|   |   |-- *views.py*
|   |   `-- views.pyc
|   |-- campaign
|   |   |-- __init__.py
|   |   |-- __init__.pyc
|   |   |-- views.py
|   |   `-- views.pyc
|   |-- __init__.py
|   |-- __init__.pyc
|   `-- response
|       |-- __init__.py
|       |-- __init__.pyc
|       |-- views.py
|       `-- views.pyc
|-- __init__.py
`-- __init__.pyc


and this is my views.py in audience
from flask import Module, render_template

audience = Module(__name__, name='audience')

@audience.route('/')
def index():
    return 'Hello audience'

@audience.route('/yoi')
def yoi():
    return render_template("audience/index.html")

in index.html there is script
    <script type="text/javascript" src="{{ url_for('*.*static',
filename='chatbox.js') }}"></script>
i've modified to
    <script type="text/javascript" src="{{ url_for('static',
filename='chatbox.js') }}"></script>

like tutorial (
http://flask.pocoo.org/docs/patterns/packages/#modules-and-resources)

but both give me this error

~/flask $ python runserver.py
 * Running on http://127.0.0.1:5000/
127.0.0.1 - - [07/Feb/2011 16:59:22] "GET /audience/yoi HTTP/1.1" 200 -
127.0.0.1 - - [07/Feb/2011 16:59:22] "GET /static/chatbox.js HTTP/1.1" 404 -

so how to make chatbox.js work in html??