How do I unlock the app engine database when localhost runs?
Asked Answered
S

4

7

Right now I get a blank page when localhost runs, but the deployed app is fine. The logs show the "database is locked". How do I "unlock" the database for localhost?

Somatic answered 14/12, 2013 at 1:42 Comment(0)
A
9

This can happen if you're running multiple instances of dev_appserver without giving them distinct datastore files/directories. If you need to be running multiple instances, see dev_appserver.py --help and look at the options for specifying paths/files.

Absorbed answered 14/12, 2013 at 1:52 Comment(4)
Newbie question - how did I get to the point where I'm running multiple instances of dev_appserver? I'm only running one folder for each app. Is there a way to undo this in the app engine sdk/google app engine launcher?Somatic
This often happens when using dev_appserver from the command line in multiple shell windows. Sorry, but have very little experience with the launcher, being an old-school command-line kind of developer.Absorbed
I went into the docs (developers.google.com/appengine/docs/python/tools/devserver) and tried dev_appserver.py --max_module_instances=1 in command line, and it said I had too few arguments?Somatic
You need to include a path to the directory that hold app.yaml. (. is fine if you're already there.)Absorbed
C
8

Dave W. Smith has the right idea. I had this same issue and looking into the docs you need to set the --storage_path='some/path' to be different for each instance of the localhost.

From the Docs:

 --storage_path PATH      path to the data (datastore, blobstore, etc.)

Also, different port and admin_ports have to be set to run the two instances.

Carilyn answered 8/11, 2016 at 17:48 Comment(1)
To elaborate: When the dev server starts it uses the default datastore, which it locks, so other dev servers cannot access it, hence the message. So use: dev_appserver.py ./ --port=<unique port number> --admin_port=<unique port number> --storage_path=<unique path> e.g. dev_appserver.py ./ --port=8001 --admin_port=8002 --storage_path=var/api. Using var/api will create this path in your app's file structure.Penutian
R
2

I tried this and it worked, I noticed that when this happens, there are multiple pythonw.exe processes working in the process bar.

Go to command prompt, run the following

taskkill /f /im pythonw.exe 

Restart your application from the app launcher

Ref answered 12/8, 2014 at 18:53 Comment(2)
Just python.exe for me, and I had to open in Administrator mode.Selfmoving
In Windows, the task manager was showing multiple copies of python.exe task. Killing a task fixed it.Woodson
I
0

So with your command to start the server which should be start_in_shell.sh -f -p 8xxx -a 8xxx

do include a -s flag after the -f as below:

start_in_shell.sh -f -s -p 8xxx -a 8xxx

Sometimes some unanticipated error somewhere causes this issue. Remember to keep only one of the instances with this flag(-s) and others should be started as you do usually.

This should make it work.

Ious answered 20/1, 2020 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.