I am on a mac and am attempting to use google app engine for the first time. I have the correct version of python. I created a new application and named it 'helloworld' and left all the files that are automatically generated when you create a new application unchanged. After pressing run, I was able to view the output 'Hello, world!' on my browser at localhost:8081; however, when I deploy the application there is the following error in the log:
*** Running appcfg.py with the following flags:
--no_cookies --email=killianjackson99#gmail.com --passin update
02:28 PM Application: heythereworld; version: 1
02:28 PM Host: appengine.google.com
02:28 PM
Starting update of app: heythereworld, version: 1
02:28 PM Getting current resource limits.
02:28 PM Scanning files on local disk.
Error 404: --- begin server output ---
This application does not exist (app_id=u'heythereworld').
--- end server output ---
Password for killianjackson99#gmail.com: If deploy fails you might need to 'rollback' manually.
The "Make Symlinks..." menu option can help with command-line work.
*** appcfg.py has finished with exit code 1 ***
Does anyone have any thoughts as to what might be going wrong?
Before deploy your application on the Google app engine server you need to create a project in the Google Developers Console. https://console.developers.google.com/project
All you need to know about de deployment is hier: https://developers.google.com/appengine/docs/python/gettingstartedpython27/uploading
Create your project in the Developer Console.
Add the name you entered in the Console in app.yaml:
application: my_app_name
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: helloworld.application
Related
I'm using Google App Engine, Python37 environment.
I got an error message when trying to deploy a microservice today:
I run the command:
gcloud app deploy app.yaml
Got the error:
...
File upload done.
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: script field for handler '/.*'
must be set to 'auto' for runtime python37.
PS C:\path_to_app> gcloud app deploy app.yaml
...
My app.yaml is:
service: service_name
runtime: python37
handlers:
- url: /.*
script: main.py
It looks exactly the same from other microservices that I have deployed recently, just the service name is different.
I tried to re-deploy a services that is already running and got same error message.
So I double check app.yaml reference document: https://cloud.google.com/appengine/docs/standard/python3/config/appref
But I couldn't find out what is wrong neither why the same yaml file that had worked before doesn't work anymore.
Does anyone know what can be wrong or maybe what can be changed on Google App Engine in the last days?
Thanks in advance.
As per the AppEngine documentation for Python 3.7,
The only accepted value for the script element is auto
Below is a sample entry from the documentation:
handlers:
- url: /images
static_dir: static/images
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto
The earlier answer from #Omair, while correct, is only part of the story. The OP's original question utilizes an App Engine first-generation ("Gen1") runtime app's app.yaml configuration file where the routing happens, requiring the script: directive in handlers:. While that's a perfectly valid app.yaml for a Gen1 (go111, python [2.5], python27, php55) app, it won't work for next generation ("Gen2") apps.
NOTE: Python 2 is only supported by App Engine Gen1 whereas Python 3 is only supported by App Engine Gen2 (Standard or Flex), so if you migrate from Python 2 to 3, you're also porting from Gen1 to Gen2 and need to keep in mind these differences as well. (Unfortunately, this means migrating from webapp2 to a web framework that handles routing, i.e., Django, Flask, etc.)
App Engine Gen2 requires routing to be done by your framework. As a result, all Gen1 app.yaml files need to be updated. Use of handlers: for your routes must be either removed or changed to auto (because it's done by your web framework now). If you have specific app startup instructions, you can provide an entrypoint: directive; check out these examples.
Both handlers: and entrypoint: are optional. If all script handlers are auto, you don't need handlers: unless your app is serving static files like client-side JS, CSS, HTML, images, etc., and entrypoint: is optional because if you don't specify a server, gunicorn is selected (and started) by default. Basically if you take all the defaults and don't serve static files, you can reduce app.yaml down to 1 line, like this one. That sample is from a repo I'm working on to help developers upgrade Python 2 App Engine apps to Python 3 who need more help than what's available in the official migration guide.
I got this error when deploying a flask app with a blueprint structure. The solution is to have main.py file in the same directory as app.yaml file. In the main.py file, import the app object e.g from app import app (here the first 'app' is the folder containing an init file where the flask app instance is created). After doing this, setting script to auto should work fine.
Please tell me to deploy my project for GAE.
I can not deploy my project because of the following error.
%appcfg.py update app.yaml dispatch.yaml worker.yaml
(omissions)
appcfg.py: error: Error parsing ./dispatch.yaml: Unexpected attribute 'dispatch' for object of type AppInfoExternal.
in "./dispatch.yaml", line 4, column 1.
This project has the following yaml files in direct project folder.
app.yaml
dipatch.yaml
worker.yaml
The following is dispatch.yaml.
application: my-app
dispatch:
- url: "*/worker/*"
module: worker
The following is worker.yaml.
application: my-app
module: worker
api_version: 1
threadsafe: false
version: uno
runtime: python27
instance_class: B1
manual_scaling:
instances: 1
handlers:
- url: /_ah/start
script: my-worker.app
Also, make sure you run appcfg.py update_dispatch, which is a separate command from update
Wrong indenting. Should be:
application: my-app
dispatch:
- url: "*/worker/*"
module: worker
First of all, dispatch.yaml doesn't seem to be allowed to be an argument of appcfg.py update. The error message must indicate that.
Try:
appcfg.py update app.yaml worker.yaml
Also, dispatch.yaml are not an application config, but the dispatch file. So you may not allowed to write attributes other than dispatch.
modules included in dispatch must come before the dispatch.yaml in appcfg.py update, so correct command is:
appcfg.py update app.yaml worker.yaml dispatch.yaml
I got a similar problem in latest gcp deployment, i.e, using gcloud command.
I got rid of application from dispatch.yaml and this error was gone.
I just ran into an identical error message and eventually what I discovered is that Google requires the dispatch file to be called dispatch.yaml.
My file was something like web.dispatch.yaml, which Google does not like. Renaming my file to dispatch.yaml did the trick.
I'm new in GAE development, I've just created a simple API but I'm unable to run my app, because I keep getting the error No URLMap entries found in application configuration.
Here's my app.yaml file
application: gw2
version: 1
runtime: python27
threadsafe: true
api_version: 1
handlers:
- url: /_ah/spi/.*
script: main.api_server
libraries:
- name: pycrypto
version: latest
- name: endpoints
version: 1.0
And here is my main.py file where I've declared the api_server variable
from google.appengine.ext import endpoints
import api
api_server = endpoints.api_server([api.GW2Service])
GW2Service inherits from remote.Service
Edit I'm using command line tools (Ubuntu 12.04)
Where's the mistake?
Thanks in advance. Eric ~H
You start server from the app or command line?
Try using "import endpoints" not from ... import endpoints
In app.yaml set endpoints version to latest.
Move GW2Service to main.py and test if server is ok. The problem might be generated by file name "api".
I have been trying to upload python Google app engine folder using windows command prompt. I have the app.yaml as well as a python file in the folder. But when I pass the following command in the Command Prompt:
appcfg.py --oauth2 update C:/Path/to/the/folder
I get this error.
appcfg.py: error: Directory does not contain an Project.yaml configuration file.
Where am I wrong and how should I proceed?
This is my app.yaml file:
application: myappid
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /.*
script: sampleapp.app
libraries:
- name: lxml
version: "latest"
Check your shell syntax. I had this error message also, by not referencing the right project folder. Note the ending slash:
appcfg.py --oauth2 update C:/Path/to/the/folder/
I am deploying a django-nonrel app on Google App Engine. The app deploys alright but I can't login to the remote shell.
This is my app.yaml file:
application: masnun
version: 1
runtime: python
api_version: 1
builtins:
- remote_api: on
inbound_services:
- warmup
handlers:
- url: /_ah/queue/deferred
script: djangoappengine/deferred/handler.py
login: admin
- url: /media/admin
static_dir: django/contrib/admin/media
expiration: '0'
- url: /.*
script: djangoappengine/main/main.py
But I am getting an error:
urllib2.URLError: <urlopen error HTTP Error 500: Internal Server Error
Couldn't reach remote_api handler at https://masnun.appspot.com/_ah/remote_api(/.*)?.
Make sure you've deployed your project and installed a remote_api handler in app.yaml.>
Please help me out!
Update: When using Python2.5, getting this error:
DEBUG:google.appengine.tools.appengine_rpc:Got http error, this is try #3
DEBUG:google.appengine.tools.appengine_rpc:Sending HTTPS request:
GET /_ah/remote_api(/.*)? HTTPS/1.1
Host: masnun.appspot.com
X-appcfg-api-version: 1
Content-type: application/octet-stream
User-agent: Google-remote_api/1.0 Linux/2.6.35-25-generic Python/2.5.5.final.0
Add this on app.yaml section handlers, first item:
handlers:
- url: /remote_api
script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
login: admin
and deploy again.
The problem is with
GET /_ah/remote_api(/.*)? HTTPS/1.1
If you notice, the URL contains invalid characters "(/.*)?" towards the end.
Assuming you are using django-nonrel, it is an easy fix. Open the file
djangoappengine/db/base.py
and change the line
self.remote_api_path = handler.url
to
self.remote_api_path = handler.url.split('(')[0] # remove '(/.*)' introduced in newer GAE
and that should take care of ensuring the URL is correct.
You can connect to the remote shell using
python manage.py remote shell
and only if you created your App Engine app with Google Accounts Authentication. But remote_api requires a deployed app and since your
python manage.py deploy
fails, the above error is normal.
What error do you get when you try to deploy?