Google 应用引擎帮助?
感谢您花时间阅读我的问题。
我正在尝试使用 Google 应用引擎在我的网站上嵌入类似 this 的内容。为了实现这一点,我的理解是我必须上传一个 .js 文件。目前我的页面上有此代码:
<script src='/ytembed.js' type="text/javascript"></script>
<div id="youtubeDiv"></div>
<script type="text/javascript">ytEmbed.init({'block':'youtubeDiv','type':'search','q':'03728D7DF4BBDC66','results':'50','order':'highest_rating','width': 200, 'height': 200, 'layout': thumbnails});</script><br>
它仅返回空白页面。我认为这是因为我对 .js 文件的某种实现失败。
这是我目前的应用程序文件:
application: *********
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css))
- url: .*
script: main.py
- url: \1
script: ytembed.js
Thanks for taking time to read my question.
I'm trying to embed something like this on my website using google app engine. To accomplish this my understanding is I have to upload a .js file. I currently have this code on my page:
<script src='/ytembed.js' type="text/javascript"></script>
<div id="youtubeDiv"></div>
<script type="text/javascript">ytEmbed.init({'block':'youtubeDiv','type':'search','q':'03728D7DF4BBDC66','results':'50','order':'highest_rating','width': 200, 'height': 200, 'layout': thumbnails});</script><br>
It only returns a blank page. I figured it's because i have some sort of failed implementation of the .js file.
This is my app file currently :
application: *********
version: 1
runtime: python
api_version: 1
handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css))
static_files: \1
upload: (.*\.(gif|png|jpg|ico|js|css))
- url: .*
script: main.py
- url: \1
script: ytembed.js
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您使用
static_dir
配置,如下所示:并将
ytembed.js
放在根目录中的static/js/ytembed.js
中您的应用程序,并指向 url 为http://APPHOST/static/js/ytembed.js
的 js 文件。I recommend you to use the
static_dir
configuration like this:And put the
ytembed.js
instatic/js/ytembed.js
from the root directory of your application, and point to the js file with the urlhttp://APPHOST/static/js/ytembed.js
.