app engine NeedIndexError: no matching index found - python

trying to deploy the simple guestbook
https://cloud.google.com/appengine/docs/python/gettingstartedpython27/deploying-the-application
I got an error trying to deploy the app like so :
appcfg.py --verbose -A glossy-apex-130310 -V v1 update ./
07:56 PM Application: glossy-apex-130310 (was: None); version: v1 (was: None)
07:56 PM Host: appengine.google.com
2016-05-06 19:56:11,019 INFO sdk_update_checker.py:229 Checking for updates to the SDK.
2016-05-06 19:56:11,607 INFO appcfg.py:2378 Reading app configuration.
07:56 PM
Starting update of app: glossy-apex-130310, version: v1
07:56 PM Getting current resource limits.
2016-05-06 19:56:11,608 INFO appcfg.py:1693 Send: /api/appversion/getresourcelimits, params={'version': 'v1', 'app_id': 'glossy-apex-130310'}
2016-05-06 19:56:12,350 ERROR appcfg.py:2396 An error occurred processing file '': HTTP Error 403: Forbidden Unexpected HTTP status 403. Aborting.
Error 403: --- begin server output ---
You do not have permission to modify this app (app_id=u's~glossy-apex-130310').
--- end server output ---
So I deployed it like so :
gcloud preview app deploy --project glossy-apex-130310
http://glossy-apex-130310.appspot.com/
getting this
Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~glossy-apex-130310/20160506t132909.392595029440587911/guestbook.py", line 72, in get
greetings = greetings_query.fetch(10)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/utils.py", line 160, in positional_wrapper
return wrapped(*args, **kwds)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py", line 1203, in fetch
return self.fetch_async(limit, **q_options).get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 378, in get_result
self.check_success()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 422, in _help_tasklet_along
value = gen.throw(exc.__class__, exc, tb)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/query.py", line 980, in _run_to_list
batch = yield rpc
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/ext/ndb/tasklets.py", line 508, in _on_rpc_completion
result = rpc.get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
return self.__get_result_hook(self)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2921, in __query_result_hook
yaml_index=yaml, xml_index=xml)
NeedIndexError: no matching index found. recommended index is:
- kind: Greeting
ancestor: yes
properties:
- name: date
direction: desc
The suggested index for this query is:
- kind: Greeting
ancestor: yes
properties:
- name: date
direction: desc
index.yaml file is
indexes:
- kind: Greeting
ancestor: yes
properties:
- name: date
direction: desc
I read that I'm supposed to wait a while. it's been 4 hours.
There are No indexes created here
https://console.cloud.google.com/datastore/indexes?project=glossy-apex-130310

The gcloud sdk can upload indexes to the Cloud Datastore with the create-indexes command, like this (docs):
$ gcloud preview datastore create-indexes ~/myapp/index.yaml
The App Engine SDK will upload indexes along with application code when appcfg.py is executed with the update command:
$ appcfg.py -A <YOUR_PROJECT_ID> update myapp/
or indexes can be uploaded separately when appcfg.py is executed with the update_indexes command:
appcfg.py update_indexes myapp/

Related

Odoo 12 ./odoo-bin does not run, produce a odoo.sql_db error

i have followed a tutorial and installed odoo+postgres
when i try to run in my linux terminal ./odoo-bin command, i get this error:
2019-09-15 08:48:30,765 5126 ERROR test werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 205, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 193, in execute
application_iter = app(environ, start_response)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/service/server.py", line 409, in app
return self.app(e, s)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/service/wsgi_server.py", line 128, in
application
return application_unproxied(environ, start_response)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/service/wsgi_server.py", line 117, in
application_unproxied
result = odoo.http.root(environ, start_response)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/http.py", line 1320, in __call__
return self.dispatch(environ, start_response)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/http.py", line 1293, in __call__
return self.app(environ, start_wrapped)
File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 599, in __call__
return self.app(environ, start_response)
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/http.py", line 1473, in dispatch
ir_http = request.registry['ir.http']
File "/home/blink22/Desktop/odoo-nada/odoo/odoo/modules/registry.py", line 176, in
__getitem__
return self.models[model_name]
KeyError: 'ir.http' - - -
2019-09-15 08:48:54,130 5126 ERROR test odoo.sql_db: bad query: b"SELECT latest_version
FROM ir_module_module WHERE name='base'"
ERROR: relation "ir_module_module" does not exist
LINE 1: SELECT latest_version FROM ir_module_module WHERE name='base...
^
is the error related to which DB user i am using? or it is something else??
here is my bash commands that i used to install that:
https://github.com/mah007/OdooScript/blob/master/odoo_dev.sh
however you're question is not very clear but I can assume that this issue is occurred because you didn't initiate your database before running the server.
you need first init your db (and the logs shows that its name is test):
$ ./odoo-bin -i base -d test
the you can start the Odoo server as usual.
$ ./odoo-bin
if this is a development environment then start fresh with a new database.
I had similar issue while running OdooV13 in ubuntu20. I have missed to include some addons under addons path, because of which "base" module was not found.
I was able to resolve my issue by including base module folder in addons path and run server with "-i base -d test" to initialize my database, as suggested by Ahmed Magdy.

How to properly configure a Service Account in Google AppEngine Flex w/ Python?

I am using Google AppEngine (GAE) Flexible environment with a custom runtime (python2.7). I am using custom so I can just manage a Dockerfile and have easy parity between my laptop and when deployed in GAE.
I have a python 2.7 Flask app that is doing a query against DataStore. I get the following (when starting python main.py in my local docker):
root#24dcf9b8712d:/home/vmagent/app# curl localhost:5000/things
'/home/vmagent/app/clientid-searchapp.json'
[2018-09-04 14:54:19,969] ERROR in app: Exception on /things [GET]
Traceback (most recent call last):
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/env/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "main.py", line 55, in products
for rec in query.fetch(limit=100):
File "/env/lib/python2.7/site-packages/google/api_core/page_iterator.py", line 199, in _items_iter
for page in self._page_iter(increment=False):
File "/env/lib/python2.7/site-packages/google/api_core/page_iterator.py", line 230, in _page_iter
page = self._next_page()
File "/env/local/lib/python2.7/site-packages/google/cloud/datastore/query.py", line 517, in _next_page
query=query_pb,
File "/env/local/lib/python2.7/site-packages/google/cloud/datastore_v1/gapic/datastore_client.py", line 294, in run_query
request, retry=retry, timeout=timeout, metadata=metadata)
File "/env/lib/python2.7/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "/env/lib/python2.7/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "/env/lib/python2.7/site-packages/google/api_core/retry.py", line 177, in retry_target
return target()
File "/env/lib/python2.7/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "/env/lib/python2.7/site-packages/google/api_core/grpc_helpers.py", line 56, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "/env/local/lib/python2.7/site-packages/six.py", line 737, in raise_from
raise value
PermissionDenied: 403 Missing or insufficient permissions.
127.0.0.1 - - [04/Sep/2018 14:54:19] "GET /things HTTP/1.1" 500 -
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
Snippets from main.py
app = Flask(__name__)
ds = datastore.Client()
<snip>
#app.route("/things")
def things():
global ds
pprint(os.environ['GOOGLE_APPLICATION_CREDENTIALS'])
query = ds.query(kind='Things', order=('thing_name',))
results = list()
for rec in query.fetch(limit=100):
results.append(rec)
return jsonify(results)
Output of gcloud auth list:
root#24dcf9b8712d:/home/vmagent/app# gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* <myapp>#<project-name>.iam.gserviceaccount.com
This is the configured service account. I have over-privileged it with excessive Role membership; I'm pretty certain the service account isn't lacking in permissions. In fact, it has 'DataStore Owner'
In main.py I am outputting:
pprint(os.environ['GOOGLE_APPLICATION_CREDENTIALS'])
And this outputs the path to my client-<myapp>.json file for the service account. It is the same file supplied in the Dockerfile as:
RUN gcloud auth activate-service-account --key-file=clientid-<myapp>.json --project <project-name> --quiet
I get the same results when running the Flask app in my local Docker environment and when I deploy to GAE Flexible. The Flask app has other endpoints that work as they don't call any other services. Only /things uses an API to call DataStore and it receives the above error.
I've been through all the docs. I'm sure it's something basic and obvious but afaict, everything looks right.
UPDATE:
I've tried creating the DataStore client with an explicit pass of project name with no change in result. Also, I've run this command from within the Docker container and this seems like unusual output to me but I don't know that it's incorrect for a Service Account.
root#e02b74cd269d:/home/vmagent/app# gcloud projects list
API [cloudresourcemanager.googleapis.com] not enabled on project
[<project id>]. Would you like to enable and retry (this will take a
few minutes)? (y/N)? y
When I respond w/ Y,:
ERROR: (gcloud.projects.list) PERMISSION_DENIED: Not allowed to get project settings for project <project id>
Output of gcloud config list:
root#d18c83cae166:/home/vmagent/app# gcloud config list
[core]
account = <myapp>#<myproject>.iam.gserviceaccount.com
disable_usage_reporting = False
project = <myproject>
Your active configuration is: [default]

Server error when pyramid app hosted with production.ini

I have a pyramid project that works fine when hosted with development.ini, but as soon as I use production.ini I get this error in browser:
Internal Server Error
The server encountered an unexpected internal server error
(generated by waitress)
and this log in terminal:
Starting subprocess with file monitor
Starting server in PID 5912.
serving on http://0.0.0.0:6543
2014-05-26 16:54:23,139 ERROR [waitress][Dummy-2] Exception when serving /
Traceback (most recent call last):
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/channel.py", line 337, in service
task.service()
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/task.py", line 173, in service
self.execute()
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/waitress-0.8.9-py2.7.egg/waitress/task.py", line 392, in execute
app_iter = self.channel.server.application(env, start_response)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/router.py", line 242, in __call__
response = self.invoke_subrequest(request, use_tweens=True)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/router.py", line 217, in invoke_subrequest
response = handle_request(request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/tweens.py", line 21, in excview_tween
response = handler(request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", line 82, in tm_tween
reraise(*exc_info)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid_tm-0.7-py2.7.egg/pyramid_tm/__init__.py", line 63, in tm_tween
response = handler(request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/router.py", line 163, in handle_request
response = view_callable(context, request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/config/views.py", line 377, in rendered_view
context)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/renderers.py", line 418, in render_view
return self.render_to_response(response, system, request=request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/renderers.py", line 441, in render_to_response
result = self.render(value, system_values, request=request)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/renderers.py", line 421, in render
renderer = self.renderer
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/decorator.py", line 37, in __get__
val = self.wrapped(inst)
File "/home/roman/Critical_ID/CCG_Map/local/lib/python2.7/site-packages/pyramid/renderers.py", line 404, in renderer
'No such renderer factory %s' % str(self.type))
ValueError: No such renderer factory .mak
I copied over my sqlalchemy.url and mako.directories under the [app:main] section in the .ini files, and I can't see what is causing this error.
I start the server with: ../bin/pserve/production.ini --reload
What am I missing?
This is because the latest versions of Pyramid do not require/install Mako's templating engine by default. To fix this error, as documented HERE, you must do two things:
Make sure the pyramid_mako package is installed. One way to do this is by adding "pyramid_mako" to the install_requires section of your package's setup.py file and afterwards rerunning setup.py develop:
setup(
#...
install_requires=[
'pyramid_mako', # new dependency
'pyramid',
#...
],
)
Within the portion of your application which instantiates a Pyramid Configurator (often the main() function in your project's __init__.py file), tell Pyramid to include the pyramid_mako includeme:
config = Configurator(.....)
config.include('pyramid_mako')

Google App Engine + Google Drive cache error

I don't know why my project show the next cookie error. Could someone help me?
PATH
->test
->lib
->public
->templates
- app.yaml
- main.py
- client_secrets.json
- session-secret (python -c "import os;print os.urandom(64)" > session.secret)
When I use my App Engine Launcher (release: "1.7.5") and check out my localhost web page
I chose my Google account to add permissions in accounts.google.com/AccountChooser?service....... (redirect) and then accept conditions of the scopes
The log console shows the next error:
Traceback (most recent call last):
File "C:\Program Files\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\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files\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\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files\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\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Program Files\Google\google_appengine\pruebasDocs\main.py", line 320, in get
creds = self.GetCodeCredentials()
File "C:\Program Files\Google\google_appengine\pruebasDocs\main.py", line 194, in GetCodeCredentials
session.set_secure_cookie(name='userid', value=userid)
File "lib\sessions.py", line 160, in set_secure_cookie
self.set_cookie(name, value, expires_days=expires_days, **kwargs)
File "lib\sessions.py", line 141, in set_cookie
self.response.headers._headers.append(('Set-Cookie', str(vals.OutputString(None))))
**AttributeError: ResponseHeaders instance has no attribute '_headers'**
lo.....t:8080/?code=4/00VfZ4DJ8d0P99v1kwn0yjBofcbq.gn6ceL8RBx0XYKs_1NgQtmXj_6WohwI
MAIN.PY
def GetCodeCredentials(self):
# Other frameworks use different API to get a query parameter.
code = self.request.get('code')
if not code:
# returns None to indicate that no code was passed from Google Drive.
return None
# Auth flow is a controller that is loaded with the client information,
# including client_id, client_secret, redirect_uri etc
oauth_flow = self.CreateOAuthFlow()
# Perform the exchange of the code. If there is a failure with exchanging
# the code, return None.
try:
creds = oauth_flow.step2_exchange(code)
except FlowExchangeError:
return None
# Create an API service that can use the userinfo API. Authorize it with our
# credentials that we gained from the code exchange.
users_service = CreateService('oauth2', 'v2', creds)
# Make a call against the userinfo service to retrieve the user's information.
# In this case we are interested in the user's "id" field.
userid = users_service.userinfo().get().execute().get('id')
# Store the user id in the user's cookie-based session.
session = sessions.LilCookies(self, SESSION_SECRET)
session.set_secure_cookie(name='userid', value=userid)
SESSIONS.PY
# output all their cookies to the headers at once before a response flush.
for vals in new_cookie.values():
self.response.headers._headers.append(('Set-Cookie', vals.OutputString(None)))

Uploading Unity WebPlayer app to Google App Engine getting 500 server error

I am competing in the Google App Challenge but I am unable to get the app working at the appspot domain website.I am using Python to deploy the app.Need Help
The app.yaml file details are given below
application: abhicorp111
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /WebPlayer\.unity3d
static_files: WebPlayer/WebPlayer.unity3d
upload: WebPlayer/WebPlayer\.unity3d
- url: .*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
The main.py content
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.appengine.ext.webapp import template
import webapp2
import os
class MainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
After updating from command line getting the 500 server error
The Folder structure for the app
The error that i am getting
The error log i got while uploading it through GAE log Console
> 2013-11-20 09:27:34 Running command: "['C:\\Python27\\python.exe',
> 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py',
> '--skip_sdk_update_check=yes', '--port=15080', '--admin_port=8007',
> u'E:\\GAEGame\\WebPlayer']" INFO 2013-11-20 09:27:35,315
> devappserver2.py:660] Skipping SDK update check. WARNING 2013-11-20
> 09:27:35,331 api_server.py:327] Could not initialize images API; you
> are likely missing the Python "PIL" module. WARNING 2013-11-20
> 09:27:35,588 simple_search_stub.py:1009] Could not read search indexes
> from
> c:\users\santu\appdata\local\temp\appengine.abhicorp111\search_indexes
> INFO 2013-11-20 09:27:35,648 api_server.py:138] Starting API
> server at: http://localhost:4755 INFO 2013-11-20 09:27:35,674
> dispatcher.py:168] Starting module "default" running at:
> http://localhost:15080 INFO 2013-11-20 09:27:35,700
> admin_server.py:117] Starting admin server at: http://localhost:8007
> ERROR 2013-11-20 03:57:44,651 wsgi.py:262]
>
> Traceback (most recent call last):
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 239, in Handle
>
> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 298, in _LoadHandler
>
> handler, path, err = LoadObject(self._handler)
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 84, in LoadObject
>
> obj = __import__(path[0])
>
> File "E:\GAEGame\WebPlayer\main.py", line 22
>
> def get(self):
>
> ^
>
> IndentationError: expected an indented block
>
> INFO 2013-11-20 09:27:44,663 module.py:599] default: "GET /
> HTTP/1.1" 500 - ERROR 2013-11-20 03:57:44,697 wsgi.py:262]
>
> Traceback (most recent call last):
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 239, in Handle
>
> handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 298, in _LoadHandler
>
> handler, path, err = LoadObject(self._handler)
>
> File "C:\Program Files
> (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line
> 84, in LoadObject
>
> obj = __import__(path[0])
>
> File "E:\GAEGame\WebPlayer\main.py", line 22
>
> def get(self):
>
> ^
>
> IndentationError: expected an indented block
>
> INFO 2013-11-20 09:27:44,710 module.py:599] default: "GET
> /favicon.ico HTTP/1.1" 500 -
After updating and going through the errors and then starting the server i am getting this message
This is done from another folder and then i called the appserver start command of python
C:\Windows\system32>dev_appserver.py E:\ed23\WebPlayer1
INFO 2013-11-20 13:25:04,336 sdk_update_checker.py:245] Checking for updates
to the SDK.
WARNING 2013-11-20 13:25:06,148 api_server.py:327] Could not initialize images
API; you are likely missing the Python "PIL" module.
WARNING 2013-11-20 13:25:06,641 simple_search_stub.py:1009] Could not read sear
ch indexes from c:\users\santu\appdata\local\temp\appengine.enginerite11\search_
indexes
INFO 2013-11-20 13:25:06,688 api_server.py:138] Starting API server at: http
://localhost:20091
INFO 2013-11-20 13:25:06,713 dispatcher.py:168] Starting module "default" ru
nning at: http://localhost:8080
INFO 2013-11-20 13:25:06,742 admin_server.py:117] Starting admin server at:
http://localhost:8000
ERROR 2013-11-20 07:58:37,220 webapp2.py:1552] WebPlayer1.html
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 "E:\ed23\WebPlayer1\main.py", line 28, in get
self.response.out.write(template.render(path, template_values))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\weba
pp\template.py", line 89, in render
t = _load_internal_django(template_path, debug)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\weba
pp\template.py", line 163, in _load_internal_django
template = django.template.loader.get_template(file_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_interna
l\django\template\loader.py", line 157, in get_template
template, origin = find_template(template_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_interna
l\django\template\loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: WebPlayer1.html
INFO 2013-11-20 13:28:37,285 module.py:599] default: "GET / HTTP/1.1" 500 24
09
INFO 2013-11-20 13:28:37,497 module.py:599] default: "GET /favicon.ico HTTP/
1.1" 200 1150
ERROR 2013-11-20 08:03:19,309 webapp2.py:1552] WebPlayer1.html
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 "E:\ed23\WebPlayer1\main.py", line 28, in get
self.response.out.write(template.render(path, template_values))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\weba
pp\template.py", line 89, in render
t = _load_internal_django(template_path, debug)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\weba
pp\template.py", line 163, in _load_internal_django
template = django.template.loader.get_template(file_name)
INFO 2013-11-20 13:33:19,326 module.py:599] default: "GET / HTTP/1.1" 500 24
09
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_interna
l\django\template\loader.py", line 157, in get_template
template, origin = find_template(template_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\_interna
l\django\template\loader.py", line 138, in find_template
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: WebPlayer1.html
INFO 2013-11-20 13:33:19,427 module.py:599] default: "GET /favicon.ico HTTP/
1.1" 304 -
main.py has syntax errors (incorrect indentation). You need to indent def get(self): and, further indent the code the belongs in the get method. That's what
> IndentationError: expected an indented block
is trying to tell you.
I suggest getting your app running locally in dev_appserver before uploading it. That'll cut the development cycle time way down.
From the error log:
Could not initialize images API; you are likely missing the Python "PIL" module.
You need to configure PIL for your application. From the configuring third party libraries section of the documentation, add the following to your app.yaml:
libraries:
- name: PIL
version: latest
Following that you have some basic problems with your code itself. Python is sensitive to whitepace and any statement that go inside a block need to be indented, which is why you are getting this error:
File "E:\GAEGame\WebPlayer\main.py", line 22
def get(self):
^
IndentationError: expected an indented block
All statements inside a block need to be indented; the common practice is to indent by four spaces (not tabs). Here is your code, properly indented:
from google.appengine.ext.webapp import template
import webapp2
import os
class MainHandler(webapp2.RequestHandler):
def get(self):
template_values = {
'greetings': 'greetings',
}
path = os.path.join('WebPlayer', 'WebPlayer.html')
self.response.out.write(template.render(path, template_values))
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)

Categories