Where is my local App Engine datastore? - python

How can I find where my local development datastore is located? I am using the Python SDK and Linux.

I think it depends on if you got Java or Python SDK.
For Python, here's what the instructions say from Google:
"The web server prints the location of the datastore file it is using to the terminal when it starts up. You can make a copy of the file, then restore them later to reset the datastore to a known state. Be sure to restart the web server after replacing the datastore file.
To change the location used for the datastore file, use the --datastore_path option:
dev_appserver.py --datastore_path=/tmp/myapp_datastore myapp
more info here: http://code.google.com/appengine/docs/python/tools/devserver.html

I'm using Windows 7 with the Python SDK. My local datastore is located at
C:\Users\[username]\AppData\Local\Temp\dev_appserver.datastore

To find the file location for the local AppEngine datastore on MacOSX/Python, you can run the following command:
dev_appserver.py -help
Mine was at something like:
/var/folders/uP/uP1GHkGKGqO7QPq+eGMmb++++TI/-Tmp-/dev_appserver.datastore

I think a lot of the answers on this page are out of date. Under the current Python dev kit (1.8.6) on Windows 7 I eventually found the datastore at:
c:\Users\[username]\AppData\Local\Temp\appengine.[appname]\datastore.db
I couldn't find this info in anything dev_appserver.py printed out, either with normal startup options or with --help. On other OSes you might try searching for a file called datastore.db.

For Python u can make access to datastore admin interface path:' /_ah/'
or
add the app handler to app.yaml
- url: /admin/.*
script: $PYTHON_LIB/google/appengine/ext/admin
login: admin
and access it at /admin/

I use OS X Mavericks (10.9), Python 2.7.5, and Google App Engine SDK 1.9.3 (Python).
None of the above worked for me, however, referencing #alsmola's answer, I executed sudo find / | grep datastore.db and found the file in /private/var/folders/vw/7w1zhkls4gb1wd8r160c36300000gn/T/appengine.YYYY.XXXXX/datastore.db (YYYY is the project name, XXXXX is my username).

Since it's top question on Google search and I spent quite amount of time searching for an answer I'll say that on Windows/Java mix DB file called local_db.bin.

With Maven the files are sitting here:
target/{buildName}/WEB-INF/appengine-generated/

I'll restate a solution to getting permanent datastore as it worked for me (circa Feb 2017), running GoogleAppEngineLauncher on OS X v10.10.
Create the folder path for permanent datastore
In GAEL, click on the project in question e.g. PROJECTNAME
Click Edit-Application Settings
in Extra Flags field:
--datastore_path=/Users/foo/GAE_datastore/PROJECTNAME/datastore.db
Filename has to be included; in my config, datastore.db works.
Having searched all over for GAE datastore path, and head-bonked on dev_appserver.py --datastore_path command line, it was very helpful to find this.
Application Settings under the Edit menu is an odd choice, Google :-)

The default location of the datastore for the platform you're running the app engine on is provided in the README that comes with the platform (at least, in the one for Linux). The README is in google_appengine_x.x.xx/google_appengine/README. This is what is says in the Linux'es one:
--datastore_path=DS_FILE Path to file to use for storing Datastore file
stub data.
(Default /tmp/dev_appserver.datastore)

Related

App Engine local environment shows incorrect data

Just started using Google Cloud SDK Shell after using the older, gui-based, version. I have multiple projects under development, if that matters.
Here's what I do
run gcloud SDK shell (click on the icon!)
cd \myproject
dev_appserver.py app.yaml
In the browser (Chrome),
browse to http://localhost:8000/datastore
Under Datastore Viewer, I see 'tables' from a completely different project
(say, myotherproject)
Under Datastore Indexes, I see 'indexes' from the correct project (myproject)
Under Task Queues, I see the correct queues listed (I have specified different queues setup for parts of myproject)
Everything works fine for myotherproject. So, is there something I am missing to get the Datastore Viewer to show the correct 'tables'?
Many thanks, David
Edit: no matter what project I run, Datastore Viewer shows the same data (from myotherproject) but Datastore Indexes show the correct indexes.
Edit: Windows 8.1, Python v2.7.13:a06454b1afa1
Edit: further questions 1) does gcloud sdk use a different datastore from the original app engine sdk? 2) if so, where is it by default or do I have to define it upfront?
Thanks to everyone for their help with this. It appears GCloud uses one datastore for all projects so the --datastore_path is not really optional when you have multiple paths. However, I kept getting errors with --datastore_path so I went with the following...
dev_appserver.py --storage_path=c:\gcdata\projectname app.yaml
Yes, could have been c:\temp but this gives me separate 'databases', one for each project.
Note also that GCloud SDK does not use the same data as the original App Engine SDK grrrrrr!

Can't run coursebuilder in google app engine

It is really weird that after clicking run button, it does nothing and also no log and show a clock sign on the first column.
It works normally before. However, after I messed up my python environment, the google coursebuilder can't run web application. That's my guessing. When I run which python.it only shows:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
These let me feel like I have no way to solve it!Are there anyone who came across this problem before? Any ideas or suggestions?
Updated: I follow suggestions to use command line to run web application on GAE. It reminds me here:
Update: The error message shows that GAE can't get the allocated port and domain. The reason why it happens is that when I use command line to run the web application, I also open GAE GUI to run a web app with the same port number.
So the way to solve it is to close the GAE GUI and free the port. Or we also could designate another kind of port number with command line.(--port=XXXX and --admin_port=YYYY). Or take a look at the doc:
Again thanks for the help of Mihail R!
The OP had multiple issues with GAE setup which were resolved by simply reinstalling the GAE Launcher and making sure the app was first copied into Applications from the .dmg file, then ran from the Applications instead of from inside the .dmg file, and appropriate permissions were suppose to be given so that GAE Launcher created the symlinks it needed to work properly.
More instructions on proper GAE SDK installation can be found here: https://cloud.google.com/appengine/downloads after clicking on the needed SDK and then the OS the SDK will be installed on.

How to get local users username from Web2Py?

I am working on a web2py app which I would like to be able to use some of the user's local variables to customize things a bit, specifically I am trying to get the user's domain and username.. I know that this is possible running on an Apache using the module "mod_auth_sspi".
Is this possible on a Rocket WSGI 1.2.6 server? Or has anybody tried doing this on a web2py app before? Is there a python module that could do this?
I just ended up moving the web2py app over to an Apache server. If somebody doesn't know how to do this then you can find all of the documentation here:
http://web2py.com/book/default/chapter/13
After that I installed the mod_auth_sspi module in order to get instructions. The x86 version of the module can be downloaded from here:
http://goo.gl/syzjuk
It will require an x86 installation of Apache though. After it is downloaded:
Unzip the file
Drag mod_auth_sspi.so from the bin folder into wherever you modules folder
for your Apache installation is.
Add LoadModule sspi_auth_module modules/mod_auth_sspi.so to your httpd.conf file as
well as any sspi settings you need to whichever location you need to apply security to.
I did have some issues with authentication on some browsers, but I did find solutions which you can find here:
How can you store a log in using mod_auth_sspi on Apache?

Where can i save the sqlite database on Mac OS X for a Python developed GUI app?

I'm developing a GUI Mac OS X application using PyQt+Python which will be distributed through Mac App Store. (Sadly, I have no Objective-C skills for now.)
The app makes use of an sqlite database to save the user inputs, and read from the sqlite database at specific time later. Which means my app requires the sqlite database to be readable/writable.
Before submitting to Mac App Store, right now my app runs well on my MacBook Pro(which I am currently keeping on the same location as the rest of app file dependencies).
Since i know that Apple's sandbox won't allow app read/write data(in my case which means the sqlite database) arbitrary.
My question is:
Since I'm using PyQt & Python to develop the application, where and how can i copy/save the sqlite datebase by code while installing?
If i package my program to a "myapp.app" file(using py2app or cxFreeze utilities), should i put a initial sqlite database in the "Resources" folder of the app bundle? If so, how can i get the sandbox allowed location and copy the database form "Resources" folder to the sandbox allowed location for reading/writing in my python code?
I Search a lot on the web, since i am not a Objective-C developer, i am confused by all the examples which all written in Objective-C. Is this task could be done in Python without calling the API from Cocoa/Objective-C or something?
I'm pretty new to Mac OS X development, so my question maybe foolish, sorry for this.
Thank you.
I have fixed this problem by myself.
What i did was place an initial sqlite database in the Resource folder of my app bundle, then copy it by code to a predefined path which was:
os.path.expanduser("~/com.company.AppName/data/Documents/"),
then apple's sandbox will put it in the right folder.
The good news is my app Events got approved by Apple.
You may find it on Mac App Store with the name: Events
You use QSettings to manage cross-platform storage of settings for a host of scenarios, including user inputs. Would that help?

App Engine Bulkloader

I am trying to use Bulkloader of google app engine but unfortunately could not understand what to do from documentation. It says add this part to app.yaml
builtins:
- remote_api: on
ok i have added. Then says that i have to execute this command
appcfg.py update
but i don't have any appcfg.py file. And also what is the command which executes this line?
Please somebody tell me what i am missing I use AppEngineLauncher to upload my project to server.. I have naver used a command to update or upload it.
Thanks in advance..
If you're using App Engine Launcher, simply click the Deploy button; it runs appcfg.py update. appcfg is installed as part of the SDK.
In order to call it globally you must set the python path to include google appengine library, or call it from its excact location
~/google_appengine/appcfg.py update ~/project/path_to_your_yaml_file/
where ~ stands for you home folder.
For those using the the Java GAE SDK, it comes wtih appcfg.sh, but doesn't support full features of apppcfg.py. You need to also install the Python GAELauncher. On Mac, it installs appcfg.py in /usr/local/bin.
Working only with my local datastore, I did not have an app.yaml, nor did I need to update it as per the uploading data GAE documentation. Just needed to update the web.xml with the RemoteApiServlet.
Main gotcha is the Authentication error while connecting to the local data store. It may be specific to Mac and the Charles proxy work around mentioned in that thread likewise worked for me. I did have to modify the default proxy port from 8888 to avoid conflict with my app. The workaround is tedious and the trial version of Charles comes with limitations such as shutdown after 30 minutes.
To use the main database for development, first download it from app engine:
bulkloader.py --dump --url http://<app name>.appspot.com/_ah/remote_api --filename dump.bin
It will ask for an email and password (use your google login details).
To upload it to the development environment, make sure remote_api is
enabled in app.yaml
https://developers.google.com/appengine/docs/python/tools/uploadingdata#Setting_Up_remote_api
Then run:
bulkloader.py --restore --url http://localhost:8080/_ah/remote_api --filename dump.bin --application dev~<app name>
This time for the email, just leave it blank and hit enter.

Categories