Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine Help?

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
like image 953
user1068708 Avatar asked May 20 '26 11:05

user1068708


1 Answers

I recommend you to use the static_dir configuration like this:

application: ********* 
    version: 1
    runtime: python
    api_version: 1

    handlers:

    - url: /static/
      static_dir: static

    - url: .*
      script: main.py

And put the ytembed.js in static/js/ytembed.js from the root directory of your application, and point to the js file with the url http://APPHOST/static/js/ytembed.js.

like image 88
cyraxjoe Avatar answered May 22 '26 01:05

cyraxjoe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!