Re: [google-appengine] Downloading my app The request is invalid for an unspecified reason

2012-08-15 Thread Brian Michelich
If you drop .appspot.com from the appid it should work:

> C:\google_appengine>appcfg.py download_app -A aussieclouds -V 1 
> wwwhome\aussieclouds

On Wed, Aug 15, 2012 at 1:25 PM, Kate  wrote:
>
> I get an error when downloading my app.
>
> Can anyone give me any pointers.
>
> Here is my code with the response.
>
> C:\google_appengine>appcfg.py download_app -A aussieclouds.appspot.com -V 1
> wwwhome\aussieclouds
> Host: appengine.google.com
> Fetching file list...
> Error 400: --- begin server output ---
>
> Client Error (400)
> The request is invalid for an unspecified reason.
> --- end server output ---
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/Ydwml6M_GVIJ.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] ApiProxy.getCurrentEnvironment().getAppId() returns incorrect app ID

2012-09-11 Thread Brian Michelich
Have you tried this?

https://developers.google.com/appengine/docs/java/appidentity/overview#Identifying_Itself

The Application ID can be found in the ApiProxy.Environment.getAppId() method.


On Sat, Sep 8, 2012 at 8:05 AM, Artem Kuroptev  wrote:
> Hello,
>
> I am trying to get an id of my app using
> 'ApiProxy.getCurrentEnvironment().getAppId()'.
>
> But the code returns application id with 's~' prefix. Which, I believe,
> somehow related to HDR datastore.
>
> How do I receive a clear id of my application in run-time? I don't really
> want cut the prefix from the string, because that would looks like a hack.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/htKSv-SVFWEJ.
> To post to this group, send email to google-appengine@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



Re: [google-appengine] Webapp2 GAE storing an object, redirecting, querying an object returns null?

2013-08-29 Thread Brian Michelich
The User is created as an entity group but not doing an ancestor query
in the User.by_name()

https://developers.google.com/appengine/docs/python/datastore/structuring_for_strong_consistency



On Tue, Aug 27, 2013 at 8:52 PM, Charlie Crawford  wrote:
> All,
>
> I am desktop developer in the process of learning Google App Engine and
> Webapp2.  I am having trouble saving an object to the datastore, redirecting
> to another page/handler, then fetching that object from the datastore.
> Forgive me if there is an easy answer to this question.  The following is a
> description of the code I have.
>
> I have a base handler:
>
> class BaseHandler(webapp2.RequestHandler):
>
> def set_secure_cookie(self, name, val):
> cookie_val = make_secure_val(val)
> self.response.headers.add_header(
> 'Set-Cookie',
> '%s=%s; Path=/' % (name, cookie_val))
>
> def get_secure_cookie(self, name):
> cookie_val = self.request.cookies.get(name)
> return cookie_val and check_secure_val(cookie_val)
>
> def login(self, user):
> self.set_secure_cookie('user', str(user.name))
>
> # Called before every request and stores user object
> def initialize(self, *a, **kw):
> webapp2.RequestHandler.initialize(self, *a, **kw)
> username = self.get_secure_cookie('user')
> self.user = username and User.by_name(str(username))
>
> I have a Signup page which inherits from BaseHandler:
>
> class Signup(BaseHandler):
> def get(self):
> ...
>
> def post(self):
> logging.info("Inside Signup.post()")
> has_error = False
> self.username = self.request.get('username')
> self.password = self.request.get('password')
> self.email = self.request.get('email')
>
> # Validate the input
>
> if has_error:
> self.render('signup-form.html', **signup_params)
>
> else:
> # Ensure user does not exist
> u = User.by_name(str(self.username))
>
> if u is not None:
> msg = "User already exists."
> self.render('signup-form.html', username_error = msg)
>
> else:
> new_user = User.register(self.username, self.password, self.email)
> new_user.put()
>
> self.login(new_user)
>
> self.redirect("/blog/welcome")
>
> If the user is a new user, the User db.Model object is created, the user is
> stored to the datastore, a user cookie is set and we are redirected to the
> Welcome handler:
>
> class Welcome(BaseHandler):
> def get(self):
> if self.user:
> self.render('welcome.html', username = self.user.name)
> else:
> self.redirect('/blog/signup')
>
> The intent here is that upon redirect, BaseHandler.initialize() would get
> called and would set self.user of the new user I just created.
>
> Here is what I know:
> - When signing up a new user, I am redirected back to the signup page.
> - If I then manually navigate to /blog/welcome, the page loads correctly
> with the new username populated.
>
> If I add the following logging statements into Welcome.get():
>
> class Welcome(BaseHandler):
> def get(self):
>
> username = self.get_secure_cookie('user')
> logging.info("Cookie %r obtained inside of Welcome.get().", username)
> logging.info("Found user %r", User.by_name(str(username)))
>
> if self.user:
> self.render('welcome.html', username = self.user.name)
>
> The cookie is obtained for the new username but no User object is found.
> Again, if I navigate directly to /blog/welcome, the logs report that the
> cookie is obtained and the User object is found for the new user.
>
> The User object looks like so:
>
> def users_key(group = 'default'):
> return db.Key.from_path('users', group)
>
> class User(db.Model):
> name = db.StringProperty(required = True)
> password = db.StringProperty(required = True)
> email = db.StringProperty()
> created = db.DateTimeProperty(auto_now_add = True)
> updated = db.DateTimeProperty(auto_now = True)
>
> @classmethod
> def by_name(cls, name):
> u = User.all().filter('name =', name).get()
> return u
>
> @classmethod
> def register(cls, name, password, email = None):
> return User(parent = users_key(),
>name = name,
>password = password,
>email = email)
>
> ...
>
> Is there something about the datastore that is causing this first query to
> get the new user to return nothing?  How should I proceed in debugging this?
> Is there additional reading I should do?  (I have tried to provide all
> necessary code snippets but I can provide additional code if required.)
>
> Thanks,
> Charlie
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appeng

Re: [google-appengine] deploy jsp project in google app engine

2013-08-29 Thread Brian Michelich
The getting started docs take you through a simple application and
deployment to appengine

https://developers.google.com/appengine/docs/java/gettingstarted/introduction

On Wed, Aug 28, 2013 at 12:51 PM, ARJUN K P  wrote:
> i am create a jsp ( 2 page project).
> how to i deploy that project in Google app engine?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] Need help to get a cron job working - supposed to send a test email

2013-12-26 Thread Brian Michelich
Are you getting a 404?

It's most likely caused by the order of your url mappings.  The url:
.* is catching everything but that route isn't defined in the
main.app.

If you move the more specific mapping, url: /tasks/sendtestemail above
it in the app.yaml, it should get to the correct wsgi app.

On Fri, Dec 20, 2013 at 3:24 PM,   wrote:
> I'm trying to set up a cron job to test sending email but it keeps failing.
>
> My app.yaml file looks like this:
>
> application: nameofmytestapp
> version: 1
> runtime: python27
> api_version: 1
> threadsafe: yes
>
> handlers:
> - url: /favicon\.ico
>   static_files: favicon.ico
>   upload: favicon\.ico
>
> - url: .*
>   script: main.app
>
> - url: /tasks/sendtestemail
>   script: sendtestemail.app
>
> libraries:
> - name: webapp2
>   version: "2.5.2"
>
> My cron.yaml file looks like this:
>
> cron:
> - description: every 5 minutes test email
>   url: /tasks/sendtestemail
>   schedule: every 5 minutes
>
>
>
> My sendtestemail.py file looks like this:
>
> #!/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.
> #
>
> # send a test email from Google App Engine
>
> import webapp2
> from google.appengine.api import mail
>
> mail.send_mail("myusern...@gmail.com", "emailrecipi...@hotmail.com", "Test
> email from GAE", "Testing...done!")
>
> Obviously, myusername is actually my gmail and app engine username and
> emailrecipient is the email account I'm attempting to send a test email to.
>
> Any ideas where I'm going wrong here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [google-appengine] Need help to get a cron job working - supposed to send a test email

2013-12-26 Thread Brian Michelich
Are you getting a 404?

It's most likely caused by the order of your url mappings.  The url:
.* is catching everything but that route isn't defined in the
main.app.

If you move the more specific mapping, url: /tasks/sendtestemail above
it in the app.yaml, it should get to the correct wsgi app.

On Fri, Dec 20, 2013 at 3:24 PM,   wrote:
> I'm trying to set up a cron job to test sending email but it keeps failing.
>
> My app.yaml file looks like this:
>
> application: nameofmytestapp
> version: 1
> runtime: python27
> api_version: 1
> threadsafe: yes
>
> handlers:
> - url: /favicon\.ico
>   static_files: favicon.ico
>   upload: favicon\.ico
>
> - url: .*
>   script: main.app
>
> - url: /tasks/sendtestemail
>   script: sendtestemail.app
>
> libraries:
> - name: webapp2
>   version: "2.5.2"
>
> My cron.yaml file looks like this:
>
> cron:
> - description: every 5 minutes test email
>   url: /tasks/sendtestemail
>   schedule: every 5 minutes
>
>
>
> My sendtestemail.py file looks like this:
>
> #!/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.
> #
>
> # send a test email from Google App Engine
>
> import webapp2
> from google.appengine.api import mail
>
> mail.send_mail("myusern...@gmail.com", "emailrecipi...@hotmail.com", "Test
> email from GAE", "Testing...done!")
>
> Obviously, myusername is actually my gmail and app engine username and
> emailrecipient is the email account I'm attempting to send a test email to.
>
> Any ideas where I'm going wrong here?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-appengine+unsubscr...@googlegroups.com.
> To post to this group, send email to google-appengine@googlegroups.com.
> Visit this group at http://groups.google.com/group/google-appengine.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.


[google-appengine] Standard Env built-in libs docs missing

2016-04-28 Thread Brian Michelich
This 
page 
https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27 
links to the available libraries and versions for the standard environment 
but the page is missing.

https://cloud.google.com/appengine/docs/python/refdocs/libraries/built-in-libraries-27


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/340571e2-25a2-4013-860a-c37d7f581725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Flexible environment not compiling python

2016-05-31 Thread Brian Michelich
Hello,
I have a python flexible environment running for a service called worker. 
 It's pretty simple, a process will parse a csv file and create model 
entities.

If I delete all the *.pyc files, the application fails to run with errors 
saying the python files aren't found.  If I include the pyc files during 
the deploy the application runs as expected.

I would expect the python runtime in a flexible environment to compile and 
run the *.py files as needed.  Is this incorrect?

app.yaml:

service: worker
runtime: python-compat
threadsafe: true
vm: true

handlers:
- url: /worker/.*
  script: routes.application


Error if I don't include the pyc files:

Failed to import routes.application Traceback (most recent call last): File 
"/env/local/lib/python2.7/site-packages/vmruntime/wsgi_config.py", line 55, 
in app_for_script app, unused_filename, err = wsgi.LoadObject(script) File 
"/env/local/lib/python2.7/site-packages/google/appengine/runtime/wsgi.py", 
line 85, in LoadObject obj = __import__(path[0]) File 
"/home/vmagent/app/routes.py", line 3, in  from env import 
ON_SERVER ImportError: No module named env



-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/aa4f1a18-9554-4cb6-ace2-65bf2b4ddf62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: Flexible environment not compiling python

2016-06-01 Thread Brian Michelich
Additional information, this seems to be isolated to .py files that are 
symlinks.

my project has multiple services and share common code via symlink.

project
-- common
 models.py

-- web_service (standard app engine)
 models.py (symlinked to ../common/models.py)

-- worker_service (flexible env app engine)
 models.py (symlinked to ../common/models.py)

The models.py throws the "No module named models.py" if I don't compile 
before deploying.

On Tuesday, May 31, 2016 at 5:09:26 PM UTC-5, Brian Michelich wrote:
>
> Hello,
> I have a python flexible environment running for a service called worker. 
>  It's pretty simple, a process will parse a csv file and create model 
> entities.
>
> If I delete all the *.pyc files, the application fails to run with errors 
> saying the python files aren't found.  If I include the pyc files during 
> the deploy the application runs as expected.
>
> I would expect the python runtime in a flexible environment to compile and 
> run the *.py files as needed.  Is this incorrect?
>
> app.yaml:
>
> service: worker
> runtime: python-compat
> threadsafe: true
> vm: true
>
> handlers:
> - url: /worker/.*
>   script: routes.application
>
>
> Error if I don't include the pyc files:
>
> Failed to import routes.application Traceback (most recent call last): 
> File "/env/local/lib/python2.7/site-packages/vmruntime/wsgi_config.py", 
> line 55, in app_for_script app, unused_filename, err = 
> wsgi.LoadObject(script) File 
> "/env/local/lib/python2.7/site-packages/google/appengine/runtime/wsgi.py", 
> line 85, in LoadObject obj = __import__(path[0]) File 
> "/home/vmagent/app/routes.py", line 3, in  from env import 
> ON_SERVER ImportError: No module named env
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/ee40a880-f2cd-458b-a5c2-8e91f023ab1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.