简体   繁体   中英

Server Internal Error in google app engine using python

import webapp2
import mysql.connector

class MainHandler(webapp2.RequestHandler):
    def get(self):
        db=mysql.connector.connect(host="localhost",user="root",password="bsit",database="registration")
        mycursor=db.cursor()
        mycursor.execute("select * from student")
        result=mycursor.fetchall()
        self.response.write(str(result))

app = webapp2.WSGIApplication([('/', MainHandler)], debug=True)

Internal Server Error The server has either erred or is incapable of performing the requested operation.

Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "C:\Users\Aaqib Nadeem\Desktop\db-test\main.py", line 6, in get
    db=mysql.connector.connect(host="localhost",user="root",password="bsit",database="registration")
  File "C:\Python27\lib\mysql\connector\__init__.py", line 162, in connect
    return MySQLConnection(*args, **kwargs)
  File "C:\Python27\lib\mysql\connector\connection.py", line 129, in __init__
    self.connect(**kwargs)
  File "C:\Python27\lib\mysql\connector\connection.py", line 454, in connect
    self._open_connection()
  File "C:\Python27\lib\mysql\connector\connection.py", line 418, in _open_connection
    self._do_handshake()
  File "C:\Python27\lib\mysql\connector\connection.py", line 141, in _do_handshake
    packet = self._socket.recv()
  File "C:\Python27\lib\mysql\connector\network.py", line 255, in recv_plain
    errno=2055, values=(self.get_address(), _strioerror(err)))
OperationalError: 2055: Lost connection to MySQL server at 'localhost:3306', system error: 

Please provide a solution of this error

There is no way to use MySQL with Google App Engine. You can use GAE Cloud SQL instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM