GoogleCloudPlatform / getting-started-django

Example of using Django with Google App Engine Managed VMs
https://cloud.google.com/python
Apache License 2.0
11 stars 11 forks source link

Deploy Django app on GCP. Got "ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error:" #3

Open satendrapratap opened 6 years ago

satendrapratap commented 6 years ago

I am trying to deploy my django backend rest apis on GCP by following the google tutorial at https://cloud.google.com/python/django/flexible-environment

I was able to deploy sample app successfully but when I am trying to deploy my django app then I get below errors:

Updating service [default] (this may take several minutes)...failed. ERROR: (gcloud.app.deploy) Error Response: [9] Application startup error: [2018-04-03 13:01:35 +0000] [1] [INFO] Starting gunicorn 19.7.1 [2018-04-03 13:01:35 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1) [2018-04-03 13:01:35 +0000] [1] [INFO] Using worker: sync [2018-04-03 13:01:35 +0000] [7] [INFO] Booting worker with pid: 7 [2018-04-03 13:01:35 +0000] [1] [INFO] Shutting down: Master [2018-04-03 13:01:35 +0000] [1] [INFO] Reason: Worker failed to boot.

In build history, it shows success: Build information Status
Build successful Build id
b2f2ab39-18df-420e-8fac-eeda74dc7a75 Image
eu.gcr.io/bcbackend-200008/appengine/default.20180403t182207:latest Trigger — Source
gs://staging.bcbackend-200008.appspot.com/eu.gcr.io/bcbackend- 200008/appengine/default.20180403t182207:latest Started April 3, 2018 at 6:23:32 PM UTC+5:30 Build time
6 min 13 sec

In GCP logs also it shows no error but "Worker failed to boot": A 2018/04/03 13:01:32 Ready for new connections A 2018/04/03 13:01:33 Listening on /cloudsql/bcbackend-200008:europe- west3:bc-mysql-instance for bcbackend-200008:europe-west3:bc-mysql-instance A [2018-04-03 13:01:35 +0000] [1] [INFO] Starting gunicorn 19.7.1 A [2018-04-03 13:01:35 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1) A [2018-04-03 13:01:35 +0000] [1] [INFO] Using worker: sync A [2018-04-03 13:01:35 +0000] [7] [INFO] Booting worker with pid: 7 A [2018-04-03 13:01:35 +0000] [1] [INFO] Shutting down: Master A [2018-04-03 13:01:35 +0000] [1] [INFO] Reason: Worker failed to boot.

Tried running it with "--verbosity=debug" option and below is the log:

`DEBUG: (gcloud.app.deploy) Error Response: [9] Application startup error: [2018-04-04 12:34:42 +0000] [1] [INFO] Starting gunicorn 19.7.1 [2018-04-04 12:34:42 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1) [2018-04-04 12:34:42 +0000] [1] [INFO] Using worker: sync [2018-04-04 12:34:42 +0000] [7] [INFO] Booting worker with pid: 7 [2018-04-04 12:34:43 +0000] [1] [INFO] Shutting down: Master [2018-04-04 12:34:43 +0000] [1] [INFO] Reason: Worker failed to boot. Traceback (most recent call last): File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 788, in Execute resources = calliope_command.Run(cli=self, args=args) File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 760, in Run resources = command_instance.Run(args) File "/usr/lib/google-cloud-sdk/lib/surface/app/deploy.py", line 81, in Run parallel_build=False) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 583, in RunDeploy flex_image_build_option=flex_image_build_option) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 392, in Deploy extra_config_settings) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/app/appengine_api_client.py", line 200, in DeployService poller=done_poller) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 310, in WaitForOperation sleep_ms=retry_interval) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 251, in WaitFor sleep_ms, _StatusUpdate) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 309, in PollUntilDone sleep_ms=sleep_ms) File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 226, in RetryOnResult if not should_retry(result, state): File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/util/waiter.py", line 303, in _IsNotDone return not poller.IsDone(operation) File "/usr/lib/google-cloud-

sdk/lib/googlecloudsdk/api_lib/app/operations_util.py", line 179, in IsDone encoding.MessageToPyValue(operation.error))) OperationError: Error Response: [9] Application startup error: [2018-04-04 12:34:42 +0000] [1] [INFO] Starting gunicorn 19.7.1 [2018-04-04 12:34:42 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)`

tswast commented 6 years ago

/cc @SurferJeffAtGoogle @michaelawyu

michaelawyu commented 6 years ago

Hi @satendrapratap ! Can you run your Django app locally without a problem?

waprin commented 6 years ago

It's worth noting this repo is not maintained (and never really was), and that the relevant sample is in python-docs-samples, so at least this issue should have been there, it's unclear which code was being run. This repo should be archived.