0

Previously, I have a Google App Engine application (jstock-static), which is only used to host some static files so far. Inside folder WEB-INF, here are the content

war/WEB-INF/web.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
</web-app>

war/WEB-INF/appengine-web.xml*

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>jstock-static</application>
    <version>1</version>
</appengine-web-app>

Now, I would like to host some python scripts. Instead of creating another application, I decide to make the scripts re-inside jstock-static application.

I add 2 new files to see whether it works. (They are highlighted in red)

enter image description here

Here is the content of newly added files.

war/app.yaml

application: jstock-static
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
  script: helloworld.py

I then try to upload it to app engine server using the following command.

C:\Projects\jstock-static\war>c:\appengine-java-sdk-1.3.2\bin\appcfg.cmd update .

However, when I make a request through web browser using http://jstock-static.appspot.com/helloworld.py, the script is not being executed. Instead, the entire python script was being downloaded.

May I know is there anything I had missed out?

1 Answer 1

3

You can't execute Python code from an application running on the Java runtime (unless you use Jython). Python applications don't go inside a war, and need to be deployed using the appcfg.py script in the Python SDK.

Sign up to request clarification or add additional context in comments.

2 Comments

But it seems like is something can be done. code.google.com/appengine/kb/java.html#pythonandjava Running both Python and Java in the same application?
You need to have a completely separate version of your application that uses the Python runtime, with a different version number, and deployed separately. They will not be available at the same hostname; non-default ones need to be accessed at version.latest.yourapp.appspot.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.