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?

mango
  • 543
  • 1
  • 5
  • 14

4 Answers4

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.

Dave W. Smith
  • 24,318
  • 4
  • 40
  • 46
  • 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? – mango Dec 15 '13 at 07:53
  • 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. – Dave W. Smith Dec 16 '13 at 05:35
  • I went into the docs (https://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? – mango Dec 16 '13 at 23:21
  • You need to include a path to the directory that hold `app.yaml`. (`.` is fine if you're already there.) – Dave W. Smith Dec 23 '13 at 01:44
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.

shakaran
  • 10,612
  • 2
  • 29
  • 46
Paul Bendevis
  • 2,381
  • 2
  • 31
  • 42
  • 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= --admin_port= --storage_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. – nick Feb 07 '18 at 09:22
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

Peter O.
  • 32,158
  • 14
  • 82
  • 96
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.

Apurva Kunkulol
  • 445
  • 4
  • 17