As a disclaimer, I'm new to app development.
So I've been working on this website using Google App Engine with the Python Runtime Environment. Problems arose when I was creating a simple form in HTML and decided to use PHP to store the data. Am I allowed to use PHP scripts when my application is being run in Python?
I also noticed that GAE now has a PHP runtime environment, so should I use that instead? I only used Python because it was easy to use at first and I didn't think I needed PHP.
This is what my main.py
looks like, if it matters:
import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
class MainHandler(webapp.RequestHandler):
def get (self, q):
if q is None:
q = 'index.html'
path = os.path.join (os.path.dirname (__file__), q)
self.response.headers ['Content-Type'] = 'text/html'
self.response.out.write (template.render (path, {}))
def main ():
application = webapp.WSGIApplication ([('/(.*html)?', MainHandler)], debug=True)
util.run_wsgi_app (application)
if __name__ == '__main__':
main ()
No, you will not be able to run PHP scripts in the Python runtime environment. If your application is more easily written in PHP, you can use the PHP runtime environment.
In app.yaml
, set runtime: php
, and create handlers:
where the script:
value is a PHP script:
applciation: helloworld
version: 1
runtime: php
api_version: 1
handlers:
- url: /.*
script: helloworld.php
Then helloworld.php
can be a PHP script, such as:
<?php
echo 'Hello, world!';
?>
Note that you can use the same SDK for both Python and PHP.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments