I have just started using GAE (Python 2.7 SDK 1.6.4) , I have set up a
simple test project using Pydev (latest version) in eclipse (indigo)
on Windows XP (SP3).
It all works fine, my app can record data in the datastore and the blobstore
and then retrieve it, but when I stop the development server and start
it again the data in the datastore is lost. This is not the case for
the blobstore which is retaining blobs fine and I can see the
blobstore folder that gets created in C:\Temp
I did the sensible thing and look back through old posts and found
that most people who have this problem solve it by changing the
location of the datastore file, so I used the following parameters;
--datastore_path="${workspace_loc}/myproject/datastore"
--blobstore_path="${workspace_loc}/myproject/blobstore"
"${workspace_loc}/myproject/src"
I moved the blobstore at the same time as you can see.
The blobstore still works, and now the blobstore folder is created in
myproject folder as expected. The datastore file is still not created
however, and when I stop and restart the development server the data
is still lost.
The dev server startup logs include the following entry
WARNING 2012-04-20 10:49:04,513 datastore_file_stub.py:513] Could not
read datastore data from C:\myworkspace\myproject\datastore
So I know it is trying to create the datastore in the correct place.
Finally I lifted the whole eclipse workspace folder and copied it to
another computer with exactly the same setup except it is running
Windows 7 instead of Windows XP.
Everything works fine there - both the datastore file and blobstore
folder are now created where I expect them to be.
I have set up eclipse, python, gae, my project and my eclipse launch
file in exactly the same way on two computers, it works on one and
not the other. Maybe XP is something to do with it but to be honest I
think that's unlikely.
The only other clue I have come up with is that a recent change to the
GAE development server stopped writing to the datastore file after
every change and only flushes on exit, this problem may be closely related to mine;
App Engine local datastore content does not persist
However adding the following to my code did not help at all.
from google.appengine.tools import dev_appserver
import atexit
atexit.register(dev_appserver.TearDownStubs)
So it's not down to incorrect termination sequence either as far as I
can tell although it may be that I was just added it in the wrong place (I'm am new to python).
Anyway I am stumped and I would be really grateful for suggestions you
guys can come up with.
It's probably http://code.google.com/p/googleappengine/issues/detail?id=7244 and a bug. Hopefully a fix will be available soon.
did you try:
--storage_path=...
Path at which all local files (such as the Datastore, Blobstore files, Google Cloud Storage Files, logs, etc) will be stored, unless overridden by --datastore_path, --blobstore_path, --logs_path, etc.
found at https://developers.google.com/appengine/docs/python/tools/devserver?csw=1
Related
I have a telegram bot, and it saves the user's audio messages and photos in the repository and DB(path only), I deployed it in on pythonanywhere and everything works.
But before that, I tried to deploy it on heroku and ran into the problem that you can't store files there and everything can only be done through databases.
Do I understand correctly that you need to create a field in the database that stores the file itself, or are there other ways?
You may use, for example, cloudinary. They provide 25GB of bandwidth for free. The service is intended to be used for pictures but works well with other files as well. AND it has a good API to go with it for many programming languages (not sponsored)).
I have everything set up so that my discord bot runs on Google Cloud, but my only problem is that I can't seem to figure out how to update or delete files on the cloud disk drive. I am searching everywhere and I can't seem to find it. This bugs me because now I have to completely rename my bot every time I upload it or else I can't run it. This issue is really hurting my coding because I want to move forward, but I am very thorough and this issue will haunt me if I just leave it be.
I found the answer finally and to edit files you have to use vi, vim, or nano in the terminal. To remove the files you have to use rm. I think Google should make a better way to access the directory and edit my disk without having to use command lines, but I doubt they will.
Please note that GCP only offers e virtual infrastructure (for Compute Engine). The VM still runs a regular Operating System (with certain files pre packaged in to make sure it works with the cloud environment). Management of the operating system is still up to the user.
You can use something like App Engine if you only want to manage and update the code for your application.
Alternatively, you can also use gcloud compute scp to copy files from a local system directly to the VM.
Hi guys I've dumped (made a backup) of my Appengine datastore entities,following this tutorial, now I wonder if there is a way to restore the data locally ? so I can do some test and debug.
In windows, the datastore is in the directory
C:\Users\UserName\AppData\Local\Temp\AppName
In OSx this question can help you
In this directory are storade the datastore.db (the local storage), change the name (the app should not be running, and if is locked, kill all the python process)
Now go to the appengine dashboard
click in your app link
click in Blob Viewer (i'm assumming that you did the backup into a blobstore)
click in the file name
click in download
rename the file to datastore.db
copy to the previous path
start the app
Remote API (as koma mentions) is the main GAE-documented approach, and it's a good approach. Alternatively, you can download the entities using the cloud download tool, write your own store reader/deserializer, and execute it within your dev server local instance: http://gbayer.com/big-data/app-engine-datastore-how-to-efficiently-export-your-data. Read the part about the New Approach...
While these options are not automatic and require engineering, I really wanted to point out the side effect of doing this: We have been facing performance issues in the local development server for months now, specifically when the datastore has more than 1,000 entities with over 50 indexes. Just search for "require_indexes slow" and you'll see what I'm talking about.
I'm sure you have a solid reason to import lots of data locally for testing and debugging, just wanted to let you know your application will perform extremely slow, and debug mode will be impossibly slow; we can't even use debug mode with our setup anymore.
If you want to get some test data in your local db, you could copy some using the remote api
I am having a slight problem with the appengine SDK.
When I close it, it clears the datastore.
It is a little annoying to create the test data/users every day, so any help would be great.
I am running OSX, just so you know. And I have read this question.
But I have no file anywhere on my machine with that name. Not even when the SDK is running and the datastore contains data.
The project is not set to clear datastore on startup and I can't see anything else relating to it in the settings.
Does anyone know why this is happening?
By default, the Python SDK puts the datastore files in your system's temporary directory, thus the persistence of the datastore is not guaranteed. Provide a different path using the --datastore_path argument of dev_appserver.py.
I accidently deleted my application code from my own machine, however it's running on Google App Engine (GAE), is there a way I could download it from there?
--
app engine actually recently added the ability for the developer who uploaded a given app version to download its source code:
http://code.google.com/appengine/docs/python/tools/uploadinganapp.html#Downloading_Source_Code
You cannot do this unless you have prepared your app ahead of time properly. There is a chance the trick described by Nick in the duplicate question here might work for you. Otherwise, I would suggest using source control like git or svn.