I am unable to access dashboard/admin interface of Google app engine on local development environment which could be access using localhost:8000/_ah/admin/.
It throws following error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2726, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2611, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 653, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1675, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1575, in ExecuteCGI
reset_modules = exec_script(config, handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1277, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 94, in <module>
class _AhAdminXsrfToken_(db.Model):
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 539, in __init__
_initialize_model(cls, bases)
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 523, in _initialize_model
cls._meta = _meta(cls, bases)
File "C:\Projects_2013_05_14\retail\common\appenginepatch\appenginepatcher\patch.py", line 246, in __init__
raise ValueError('Django expects models (here: %s.%s) to be defined in their own apps!' % (model.__module__, model.__name__))
ValueError: Django expects models (here: __main__._AhAdminXsrfToken_) to be defined in their own apps!
My development environment is as follows.
Google App Engine 1.6.1
Python 2.5
Google app engine patch for Django 1.1
I am unable to understand what is going wrong over here.
Appreciate your help.
Related
I'm trying to load, all sale.order objects on draft state, and also trying to filter all these drafts by dates, so far, this is what I have:
#api.multi
#api.depends('sale_order')
def _compute_amount_total(self):
draft_orders = self.env['sale.order'].search([('state', '=', 'draft'),('date_order','<=', time.strftime('%%Y-12-31')),('date_order','>=',time.strftime('%%Y-09-01'))])
amount_total = sum(draft_orders.mapped('amount_total'))
for record in self:
record.amount_total = amount_total
But when I try to access this on my view, this is the error i get:
2017-08-26 23:34:35,292 4868 ERROR bsi_def openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 546, in _handle_exception
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 583, in dispatch
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 319, in _call_function
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\service\model.py", line 118, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 316, in checked_call
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 812, in __call__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 412, in response_wrap
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\web\controllers\main.py", line 944, in call_kw
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\web\controllers\main.py", line 936, in _call_kw
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 399, in old_api
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 5955, in onchange
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 5657, in __getitem__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 838, in __get__
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 946, in determine_draft_value
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\fields.py", line 885, in _compute_value
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\openerp\addons\account_budget_extended\models\models.py", line 170, in _compute_amount_total
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 266, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 508, in new_api
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 1650, in search
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\api.py", line 268, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\models.py", line 4708, in _search
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\sql_db.py", line 171, in wrapper
File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\sql_db.py", line 247, in execute
DataError: la sintaxis de entrada no es válida para tipo timestamp: «%Y-12-31»
LINE 1: ...e" = 'draft') AND ("sale_order"."date_order" <= '%Y-12-31'...
I think is Postgres related, but I'm not sure how to declare a domain filter of date type on Odoo's orm.
The draft domain works perfectly, I think the domain concatenation is also fine, there must be something with the date domain.
Any ideas?
Doubling the percent sign escapes it. If you want to use it as part of a format specifier then you must only have one.
I'm in the process of switching an application over from Python 2.5 to 2.7 and have begun encountering a problem with the images service. For example, saving this entity using db.put():
from google.appengine.api import images
class Images(db.Expando):
ImageTitle = db.StringProperty()
ImageFile = blobstore.BlobReferenceProperty()
ImageReference = db.StringProperty()
def put(self, **kwargs):
if not self.ImageReference:
self.ImageReference = images.get_serving_url(self.ImageFile.key())
super(Images, self).put(**kwargs)
Now yields this error:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1536, in __call__
rv = self.handle_exception(request, response, e)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1530, in __call__
rv = self.router.dispatch(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 1102, in __call__
return handler.dispatch()
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files (x86)\Google\google_appengine\lib\webapp2\webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "C:\Users\VB User\Bruha\src\handler_product_page_image.py", line 40, in post
image.put()
File "C:\Users\VB User\Bruha\src\db_models.py", line 56, in put
self.ImageReference = images.get_serving_url(self.ImageFile.key())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1792, in get_serving_url
rpc = get_serving_url_async(blob_key, size, crop, secure_url, filename, rpc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1907, in get_serving_url_async
None)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1034, in _make_async_call
rpc = create_rpc()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\images\__init__.py", line 1028, in create_rpc
return apiproxy_stub_map.UserRPC("images", deadline, callback)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 405, in __init__
self.__rpc = CreateRPC(service, stubmap)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apiproxy_stub_map.py", line 69, in CreateRPC
'a CreateRPC method.') % service)
AssertionError: The service "images" doesn't have a CreateRPC method.
Calling the 'execute_transforms' method also yields the same error.
Any help understanding what is going on would be much appreciated.
You are running the dev server, so when you start up check for this message `'Could not initialize images API; you are likely missing '
'the Python "PIL" module. ImportError: %s', e
If you are getting this message then the images service RPC is not being registered (the RegisterStub call in dev_appserver will be failing) and you will get the error you are seeing, because the assertion fails in CreateRPC call.
So check to see if PIL is correctly installed for Python 2.7
Trying to upload simple hello world app, I get the following error:
Traceback (most recent call last):
File "./appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "./appcfg.py", line 129, in run_file
execfile(script_path, globals_)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 4083, in <module>
main(sys.argv)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 4074, in main
result = AppCfgApp(argv).Run()
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 2544, in Run
self.action(self)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 3830, in __call__
return method()
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 2991, in Update
self.UpdateVersion(rpcserver, self.basepath, appyaml)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 2974, in UpdateVersion
lambda path: self.opener(os.path.join(basepath, path), 'rb'))
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 2131, in DoUpload
resource_limits = GetResourceLimits(self.rpcserver, self.config)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 355, in GetResourceLimits
resource_limits.update(GetRemoteResourceLimits(rpcserver, config))
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appcfg.py", line 326, in GetRemoteResourceLimits
version=config.version)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appengine_rpc.py", line 379, in Send
self._Authenticate()
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appengine_rpc.py", line 437, in _Authenticate
super(HttpRpcServer, self)._Authenticate()
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appengine_rpc.py", line 281, in _Authenticate
auth_token = self._GetAuthToken(credentials[0], credentials[1])
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appengine_rpc.py", line 233, in _GetAuthToken
e.headers, response_dict)
File "/home/mike/Documents/coder/Go/google_appengine/google/appengine/tools/appengine_rpc.py", line 94, in __init__
self.reason = args["Error"]
AttributeError: can't set attribute
The e-mail and password are correct. The app works perfectly on my local machine.
OK, finally I found the solution - a very simple one:
it appears that google appp engine is not satisfied with the regular account password, it needs the application-specific one which can be set up here:
http://support.google.com/accounts/bin/static.py?hl=en&page=guide.cs&guide=1056283&answer=185833&rd=3
I have post here about which I learned later that gae has moved here.
Basically I tried django-nonrel example, replacing its django with django-1.3.1 since I coded my app on it but it gives some basic error like cannot find django.db.utils. Note that I have created symbolic link from django -> Django-1.3.1/django and hope its not the issue.
Bases upon replies if I try to use django-nonrel version in my app similar to sample app I get error as below as if its cannot find sqlite3 backend though it mentions as one option in its choices. Also again utils.py is not found.
--> --> -->
Traceback (most recent call last):
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4143, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4049, in _Dispatch
base_env_dict=env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 616, in Dispatch
base_env_dict=base_env_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3120, in Dispatch
self._module_dict)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3024, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2887, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "I:\learn\python\event\djangoappengine\main\main.py", line 97, in <module>
main()
File "I:\learn\python\event\djangoappengine\main\main.py", line 56, in real_main
run_wsgi_app(application)
File "c:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "c:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "I:\learn\python\event\django\core\handlers\wsgi.py", line 265, in __call__
response = self.get_response(request)
File "I:\learn\python\event\django\core\handlers\base.py", line 160, in get_response
response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
File "I:\learn\python\event\django\core\handlers\base.py", line 194, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "I:\learn\python\event\django\views\debug.py", line 58, in technical_500_response
html = reporter.get_traceback_html()
File "I:\learn\python\event\django\views\debug.py", line 109, in get_traceback_html
frames = self.get_traceback_frames()
File "I:\learn\python\event\django\views\debug.py", line 228, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)
File "I:\learn\python\event\django\views\debug.py", line 180, in _get_lines_from_file
source = loader.get_source(module_name)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2518, in get_source
full_path, search_path, submodule = self.GetModuleInfo(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2482, in GetModuleInfo
submodule, search_path = self.GetParentSearchPath(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2461, in GetParentSearchPath
parent_package = self.GetParentPackage(fullname)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2437, in GetParentPackage
if self.find_module(fullname) is None:
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2045, in find_module
search_path)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2375, in FindAndLoadModule
description)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1538, in Decorate
return func(self, *args, **kwargs)
File "c:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2318, in LoadModuleRestricted
description)
File "I:\learn\python\event\django\db\__init__.py", line 77, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "I:\learn\python\event\django\db\utils.py", line 91, in __getitem__
backend = load_backend(db['ENGINE'])
File "I:\learn\python\event\django\db\utils.py", line 49, in load_backend
raise ImproperlyConfigured(error_msg)
ImproperlyConfigured: 'django.db.backends.sqlite3' isn't an available database backend.
Try using django.db.backends.XXX, where XXX is one of:
'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: cannot import name utils
what version of django is compatible with django-nonrel or do I have to do development using django-nonrel instead of Django-1.3.1 ?
As I read more on django-nonrel I feel that there are few modification needed to django code. Its not straight forward to just use the project as it is. I need to create abstract model super class and it does not support manytomanyfield which I use in my project.
I guess some one confirm these restriction then probably I can close this thread.
March 28
I removed M2M from my app. It was very minor thing just commented out M2M field.
Now I have installed python2.7.2, gae 1.6.4 and djangoappengine gives error as below:
E:\learn\python\event>python manage.py runserver
WARNING:root:E:\software\Google\google_appengine\lib\cacerts\urlfetch_cacerts.tx
t missing; without this urlfetch will not be able to validate SSL certificates.
Traceback (most recent call last):
File "manage.py", line 4, in <module>
import settings # Assumed to be in the same directory.
File "E:\learn\python\event\settings.py", line 4, in <module>
from djangoappengine.settings_base import *
File "E:\learn\python\event\djangoappengine\settings_base.py", line 6, in <mod
ule>
setup_env()
File "E:\learn\python\event\djangoappengine\boot.py", line 69, in setup_env
setup_project()
File "E:\learn\python\event\djangoappengine\boot.py", line 123, in setup_proje
ct
from .utils import have_appserver, on_production_server
File "E:\learn\python\event\djangoappengine\utils.py", line 14, in <module>
default_partition='dev')[0]
TypeError: LoadAppConfig() got an unexpected keyword argument 'default_partition
'
Regards,
Miten.
You can't just replace the version of Django in nonrel. It's actually a fork of Django, with a number of customizations.
Django-1.3.1/Django's database models do not work on Google App Engine.
Django-nonrel implements a backend so that Django models will work on Google App Engine.
So if you want to use Django models, you must use Django-nonrel. Otherwise, you can use Django for templating/forms, but you need to use Google App Engine's db.Model or ndb.Model based models.
I'm using gaesessions on gae with django. When I run the application Following error occurs while loading gaesessions.DjangoSessionMiddleware.
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 4053, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3977, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 588, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3050, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2954, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2836, in ExecuteOrImportScript
script_module.main()
File "D:\projects\tutorial\selftutor.py", line 35, in main
util.run_wsgi_app(application)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 98, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 116, in run_bare_wsgi_app
result = application(env, _start_response)
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\core\handlers\wsgi.py", line 252, in __call__
response = middleware_method(request, response)
File "D:\projects\tutorial\gaesessions\__init__.py", line 493, in process_response
patch_vary_headers(response, ('Cookie',))
File "C:\Program Files\Google\google_appengine\lib\django_1_2\django\utils\cache.py", line 127, in patch_vary_headers
if response.has_header('Vary'):
AttributeError: 'NoneType' object has no attribute 'has_header'
Please help me on this.
The middleware does not get handed a response. Check your request handler.