Where do I go to delete everything in my local db?
I saw this: http://fourtyten.blogspot.com/2009/07/how-to-empty-google-app-engines-local.html
But my WEB-INF directory doesn't have a local_db.bin
I saw this post also How to delete all datastore in Google App Engine?
If you're talking about the development datastore, you'll just have to delete the following file: "./WEB-INF/appengine-generated/local_db.bin". The file will be generated for you again next time you run the development server and you'll have a clear db.
But I can't find this folder either.
--Update---
I found this post How do I delete all entities from my local Google App-engine datastore? and it looks like I can use dev_appserver.py --clear_datastore dennys
But when I run that I get this python dev_appserver.py --celar_datastore dennys
python: can't open file 'dev_appserver.py': [Errno 2] No such file or directory
How do I find where dev_appserver.py is on my machine?
To delete data follow the steps here: http://code.google.com/appengine/docs/python/tools/devserver.html#Using_the_Datastore
This question is not longer valid, my problem is listed here: AppConfigNotFoundError for dev_appserver.py on Django-nonrel and Google App Engine
Open up a terminal and execute the following
cd /
find . -iname "*dev_appserver.py*" -type f
then add that to your path in your .bash_profile as so
PATH=$PATH:<directory from previous command>
then use the dev_appserver.py as you had previously mentioned like so
dev_appserver.py --clear_datastore=yes <your app's directory>
Keep in mind that python dev_appserver.py <your_app> might not work
Related
I'm in the process of upgrading a python2.7 gae std app to python3.7.
Everything is great except my indices just wont work.
I have a simple looking index.yaml file:
indexes:
- kind: Response
ancestor: yes
properties:
- name: __key__
direction: desc
And when I run certain commands then I get this
google.api_core.exceptions.FailedPrecondition: 400 no matching index found. recommended index is:
- kind: Response
ancestor: yes
properties:
- name: __key__
direction: desc
The command I'm using to run dev_appserver is: dev_appserver.py --application=my_project_id app.yaml.
My index.yaml file lives in the same directory as my app.yaml file.
Nothing else is running. The application itself is a Flask api, the error is coming up when I curl one of the endpoints.
What I've tried
After poking around docs and SO for a bit it seems like I might need to run the datastore emulator locally. So made sure that my gcloud components were up to date then:
gcloud beta emulators datastore env-init
# which gave me:
export DATASTORE_DATASET=firestore-datastore-280307
export DATASTORE_EMULATOR_HOST=::1:8608
export DATASTORE_EMULATOR_HOST_PATH=::1:8608/datastore
export DATASTORE_HOST=http://::1:8608
export DATASTORE_PROJECT_ID=firestore-datastore-280307
# then
gcloud beta emulators datastore start --project=my_project_id
# which gave me
stuff...
[datastore] API endpoint: http://::1:8679
[datastore] If you are using a library that supports the DATASTORE_EMULATOR_HOST environment variable, run:
[datastore]
[datastore] export DATASTORE_EMULATOR_HOST=::1:8679
[datastore]
[datastore] Dev App Server is now running.
So by combining these outputs it looks like my environment should be like:
export DATASTORE_DATASET=my_project_id
export DATASTORE_EMULATOR_HOST=::1:8679
export DATASTORE_EMULATOR_HOST_PATH=::1:8679/datastore
export DATASTORE_HOST=http://::1:8679
export DATASTORE_PROJECT_ID=my_project_id
Cool. So I leave the emulator running and try to get my dev_appserver to connect to it:
export DATASTORE_DATASET=my_project_id
export DATASTORE_EMULATOR_HOST=::1:8679
export DATASTORE_EMULATOR_HOST_PATH=::1:8679/datastore
export DATASTORE_HOST=http://::1:8679
export DATASTORE_PROJECT_ID=my_project_id
dev_appserver.py --application=my_project_id app.yaml
It starts up but when I curl my endpoint I get the same index error.
So then I kill dev_appserver and try it like this:
# same env vars as before
dev_appserver.py --support_datastore_emulator=true --application=my_project_id app.yaml
Then I get a new error:
RuntimeError: Cannot use the Cloud Datastore Emulator because the packaged grpcio is incompatible to this system. Please install grpcio using pip
I pip installed grpcio in a python2.7 env to get over that error. Now it looks like everything is running. But I'm still getting the missing index error.
And another strange thing: If I go to http://localhost:8000 and try navigating to anythin to do with datastores then I get errors like:
ConnectionError: Cannot connect to Cloud Datastore Emulator on ::1:{THE_PORT}
Which is very weird.
I'm considering going back to 2.7.
Don't go back to 2.7! If you have this problem in production, go to your developer console and check your indexes: https://console.cloud.google.com/.....
See if they are still building. It does take some time for the indexes to build.
If this only happens in development:
dev_appserver is buggy in Windows. I couldn't tell if you in on Windows or not. I had problems using dev_appserver in a virtual environment even on Mac when porting an app to Python 3.7.
You state you are using Flask. Try using the Flask server in development instead of dev_appserver. That is what worked for me. There is good documentation on this. You will start it with something like:
cd /Users/myname/venv37
source ./bin/activate
export FLASK_APP=/Users/myname/path_to_app
FLASK_ENV=development flask run --port 5000
edit:
ndb is not compatible with python 3.7. They have developed a new service Google Cloud NDB which makes the old ndb data usable: https://cloud.google.com/appengine/docs/standard/python3/migrating-to-cloud-ndb
New apps should use Cloud Datastore or Firestore. But legacy ndb apps can migrate to Google Cloud NDB.
So I have created a website with Flask and uploaded it to heroku.
The website has a database which is called test.db
In cmd i did
heroku vim -a my-app;
so now when I do dir, I get all my files, and test.db too. But how to open test.db, i tried open or read test.db. None of those seem to work. Do you know a command to open this database file?
Copy it via heroku ps:copy filename to local machine. Open it on local machine as usual.
Though in general you shouldn't rely on a database that is written to file system because on Heroku your files will be wiped once every day.
We're developing an android app with an api backend that we want to deploy via openshift.
The problem is we have the android app and the webservice in the same github project in two different folders. So I need to change the document_root so that openshift can find the python wsgi.py file.
I've already tried this:
rhc env-set OPENSHIFT_PYTHON_WSGI_APPLICATION="\${OPENSHIFT_REPO_DIR}/server/wsgi.py" --app api
But then it wouldn't find the requirements.txt because it still uses the wrong document_root.
I tried putting the requirements.txt in the root dir, that way it parses the file but installs the lib's in the wrong place.
I've also tried
rhc env-set OPENSHIFT_DOCUMENT_ROOT="\${OPENSHIFT_REPO_DIR}/server" --app api
But that didn't work either
Help please!!!!
As of the March release of OpenShift online, you can now specify the path to your WSGI with the 'OPENSHIFT_PYTHON_WSGI_APPLICATION' environment variable. You can read more about it here: https://www.openshift.com/blogs/openshift-online-march-2014-release-blog
Are you looking for OPENSHIFT_PYTHON_REQUIREMENTS_PATH
https://developers.openshift.com/en/python-overview.html
I went through all the related questions and could not find the answer, i went through the docs as well and tried all that i could, its my first time, hence having a hard time.
I have a simple django polls app with proper settings and static files, working locally.
As mentioned in the title i am trying to use django on a newly bought VPS, with nginx and gunicorn, i am using virtualenv as well.
Here is my folder structure on the server:
logs pid projhome scripts
inside the projhome i have the following directories:
bin djangopolls include lib local
as already mentioned parallel to the projhome folder i have scripts folder, with the following content:
source /home/django/projhq/bin/activate
kill `cat /home/username/pid/gunicorn.pid`
gunicorn_django -c /home/username/projhome/djangopolls/gunicorn_cfg.py
Now to start the server i need to go to the scripts folder and run the start script, i do that without any error, but when i check the IP i get 504 error.
Where am i wrong???
you might first want to cd into the directory where settings.py file is placed and then run gunicorn, so you can update your script.sh to first cd into the django project directory.
try 1 with sqlite and datastore path option
WARNING 2011-07-13 05:01:06,169 datastore_file_stub.py:511] Could not read datastore data from /home/gopal/temp.sqldb
INFO 2011-07-13 05:01:06,170 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/tmp/dev_appserver.rdbms'
try 2 with clear datastore and path option
INFO 2011-07-13 05:00:28,059 dev_appserver.py:4578] Attempting to remove file at /home/gopal/temp.sqldb
WARNING 2011-07-13 05:00:28,059 datastore_file_stub.py:511] Could not read datastore data from /home/gopal/temp.sqldb
INFO 2011-07-13 05:00:28,060 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/tmp/dev_appserver.rdbms'
INFO 2011-07-13 05:00:28,079 dev_appserver_multiprocess.py:637] Running application inqzinwebsite on port 8080: http://localhost:8080
I am using google app engine on ubuntu 11.04 and custom python2.5 install. The problem I have is, whenever I restart dev app server, old data got deleted. How Do I prevent that ? ( either by changing path of database file OR somehow telling ubuntu to not to delete file in tmp folder. ) but I could not able to do either. Any help is greatly appreciated. thanks.
edit:
I am using kay framework.
python2.5 manage.py runserver --datastore_path=/home/gopal/temp.sqldb --use_sqlite
python2.5 manage.py runserver --datastore_path=/home/gopal/temp.sqldb --clear_datastore
python2.5 manage.py runserver --datastore_path=/home/gopal/temp.sqldb
/tmp/dev_appserver.rdbms is default location of your datastore file in linux.Whenever you restart your machine, /tmp/ directory is cleaned. That's why you cannot see your old datas.
Change the datastore path to someother location other than tmp/ that should sove the issue.
dev_appserver.py --datastore_path=/tmp/myapp_datastore myapp
Ok , I tried using direct dev app server instead of manage script from kay framework and it works. So I think problem was with kay framework. Relevant issue added to kay bug list. sorry for question.
http://code.google.com/p/kay-framework/issues/detail?id=109