500 error while trying to post to a flask app from postman

979 views
Skip to first unread message

Karan Sharma

unread,
Jul 17, 2019, 9:50:26 AM7/17/19
to Google App Engine

Problem:-
I am trying to create a small test backend using flask to save some location related fields and deployed it in GCP APP ENGINE (standard) and do some basic post and get. The get calls seem to be working but when i post it throws an 500 error .

What i have tried:-

  1. When i try to post it by running python3 main.py in google console the response is a sign in page from google but when i enter the credentials doesnt go to the next screen.

  2. App worked fine in my local machine and is working in AWS EC2.Have to use gcloud due to organisation requirement.

  3. I followed the tutorial provided with google app engine for python application.

Here is the code:-
https://github.com/karan1414/sfab-test

I changed the app.py to main.py while i deployed it on GCP.

P.S : I just want some guidance on the right way to deploy a flask app on gcp. Pardon my commenting and code i am just a beginner looking to learn and improve. And this is my first question on stack overflow so do let me know if i have made some mistake while posting the question tried my best to adhere to the rules. Thank you !

David (Cloud Platform Support)

unread,
Jul 17, 2019, 2:40:36 PM7/17/19
to Google App Engine

Hello Karan,


This 500 error you are receiving could be due to missing libraries (flask) since I do not see a requirements.txt on your github. Please follow our quickstart on how to get started with Python 3.7 which covers how to install libraries using a requirements.txt.



Karan Sharma

unread,
Jul 17, 2019, 10:25:54 PM7/17/19
to google-a...@googlegroups.com
Hi , so sorry i forgot to mention i have made a requirements.txt when i deployed it to the GCP and the landing get api is working which responds with a simple "Flippingo" as i have mentioned in the comments in code . 




These get link work but the post links throw a 500.

On Thu, Jul 18, 2019 at 12:10 AM 'David (Cloud Platform Support)' via Google App Engine <google-appengine@googlegroups.com> wrote:

Hello Karan,


This 500 error you are receiving could be due to missing libraries (flask) since I do not see a requirements.txt on your github. Please follow our quickstart on how to get started with Python 3.7 which covers how to install libraries using a requirements.txt.



--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/98e08141-3566-42d1-a7b5-041f11922228%40googlegroups.com.


--
Regards,
Karan M Sharma
Full Stack Developer,
Sattvarise Technologies Pvt. Ltd.

David (Cloud Platform Support)

unread,
Jul 18, 2019, 12:48:33 PM7/18/19
to Google App Engine

The 500 error you are receiving may be due to an issue with what happens in your post, specifically when you try to write to your database. You can try catching any errors in that method or you could also check more details about the error by using the Stackdriver Logging. You can easily access your application's logs by going to the Cloud Console and clicking on the hamburger left top corner -> App Engine -> Services -> select the proper service then click on versions -> select the proper version and below diagnose, right click -> Logs. You can also access these logs from the Stackdriver Logging menu by using the filtering option. 


I have removed your projectID from the post as this is personal information that should not be shared with the public.


Karan Sharma

unread,
Jul 18, 2019, 1:24:05 PM7/18/19
to Google App Engine
Hi thank you for your input i tried what you have suggested already since my last reply .The error thrown is "sqlite3 OperationalError: attempt to write a readonly database" . Which i have been unable to resolve. There were solution which involved running some commands which i did not understand .Please excuse if these questions may be silly i am working on flask and gcp for the first time. Thank you for deleting the project id i have deleted the project too. 

David (Cloud Platform Support)

unread,
Jul 19, 2019, 2:19:16 PM7/19/19
to Google App Engine
This error is most likely caused by the inability of properly using SQL lite on App Engine standard. However, please take a look at Cloud SQL which is pretty easy to get started with within App Engine.
Reply all
Reply to author
Forward
0 new messages