I'm running my app on my local machine and using the remote API to access a datastore on my production side. Everything was working great until I tried adding a second app in google app engine launcher (I believe this is what caused the issue) because I had to merge what I was working on with some more up to date code and wanted to test as I went along. Suddenly I can't even access the remote datastore anymore. I get the error
app s~buybottandrew cannot access app dev~buybottandrew's data
I tried clearing the local datastore which allows me to access the remote datastore once, then the problem comes up again.
I read suggestions on the default_partition flag and I've tried passing that as well, with a muitiplicity of different things including nothing and an empty string.
--default_partition=s~buybottandrew
It gives me the same error no matter the argument
dev_appserver.py: error: unrecognized arguments: --default_partition=s~buybottandrew
If I remove all my remote api code and deploy it when I test it on the production server everything works perfectly. I can't seem to narrow down what is going on for the life of me.
Any input would be greatly appreciated.
--default_partition was removed in the new SDK. If you want to use the legacy SDK function, you can use old_dev_appserver.py --default_partition
Related
I try to write my first Web app using python and flask (Disclaimer: Sorry in advance for wrong terminology and not knowing obvious stuff). Testing the code on my laptop and everything works fine.
I tried to deploy it on Amazon Lightsail for the first time using this guide, because I used it throughout the development.
I tried to use flask run and flask db upgrade, but I get for both the following error message:
File "/home/ubuntu/app/venv/lib/python3.5/site-packages/ics/alarm/audio.py", line 31
self._sound: Optional[ContentLine] = None
This error does not occur on my local machine with the same code (I recommited the git code). I looked in the files on the server, but could not find a mistake.
This is my first big coding project. What would be the next steps in debugging?
I've set up a Flask server which is hosted on Firebase integrated with Cloud Run, I'm only making changes to html at the moment and using the command "firebase serve" with my localhost, however when I refresh the window and when I stop the server and restart it, my changes are still not showing up. I must be googling wrong because I can't find what I'm looking for: is there some sort of an update command, or do I need to re-build and re-deploy every time?
If the Firebase emulator suite isn't proxying the request to Cloud Run in the way you expect, you should open an issue on the firebase-tools GitHub and provide reproduction steps so they can diagnose. You should make sure that your installation of firebase-tools is fully up to date.
Note that the CLI will not deploy any new code to Cloud Run. You still have to run gcloud to update the backend.
I have tried to follow googles documentation on how to set up local development using a database (https://cloud.google.com/appengine/docs/standard/python/tools/using-local-server#Python_Using_the_Datastore). However, i do not have the experience level to follow along. I am not even sure if that was the right guide. The application is a Django project that uses python 2.7. To run the local host, i usually type dev_appserver.py --host 127.0.0.1 .
My questions are:
how do i download the data store database on google cloud. I do not want to download the entire database, just enough data to populate local host so i can do tests
once the database is download, what do i need to do to connect it to the localhost? Do i have to change a parameter somewhere?
do i need to download the datastore? Can i just make a duplicate on the cloud and then connect to that datastore?
When i run localhost, should it not already be connected to the datastore? Since the site works when it is running on the cloud. Where can i find the connection URI?
Thanks for the help
The development server is meant to simulate the whole App Engine Environment, if you examine the output of the dev_appserver.py command you'll see something like Starting Cloud Datastore emulator at: http://localhost:PORT. Your code will interact with that bundled Datastore automatically, pushing and retrieving data according to the code you wrote. Your data will be saved on a file in local storage and will persist across different runs of the development server unless it's explicitly deleted.
This option doesn't provide facilities to import data from your existing Cloud Datastore instance although it's a ready to go solution if your testing procedures can afford populating the local database with mock data through the use of a custom created script that does so programmatically. If you decide for this approach just write the data creation script and execute it before running the tests.
Now, there is another option to simulate local Datastore using the Cloud SDK that comes with handy features for your purposes. You can find the available information for it under Running the Datastore Emulator documentation page. This emulator has support to import entities downloaded from your production Cloud Datastore as well as for exporting them into files.
Back to your questions:
Export data from the Cloud instance into a GCS bucket following this, then download the data from the bucket to your filesystem following this, finally import the data into the emulator with the command shown here.
To use the emulator you need to first run gcloud beta emulators datastore start in a Cloud Shell and then in a separate tab run dev_appserver.py --support_datastore_emulator=true --datastore_emulator_port=8081 app.yaml.
The development server uses one of the two aforementioned emulators, in both cases it is not connected to your Cloud Datastore. You might create another project aimed for development purposes with a copy of your database and deploy your application there so you don't use the emulator at all.
Requests at datastore are made trough the endpoint https://datastore.googleapis.com/v1/projects/project-id although this is not related to how the emulators manage the connections in your local server.
Hope this helps.
I'm trying to create a KhanAcademy (KA) clone on Google App Engine (GAE). I downloaded the offline version of KA (http://code.google.com/p/khanacademy/downloads/list) for Mac, and set it up with GoogleAppEngineLauncher (https://developers.google.com/appengine/). Because KA was produced on Python 2.5, I have the setup running through the Python 2.5 included in the KA offline version download, and I added these extra flags to the app (to essentially duplicate the functionality of the included Run file):
--datastore_path=/Users/Tadas/KhanAcademy/code/datastore --use_sqlite
As is, GAELauncher is able to get that up and running perfectly fine on a localhost. However, to get it up on my Google appspot domain, I need to change the application name in app.yaml. When I change "application: khan-academy" in app.yaml to a new name and try to run the local version via GAELauncher (or the included Run file), the site comes up but all the content (exercises, etc.) has disappeared (essentially, the site loses most of its functionality). If I try to "Deploy" the app in this state, I received a 500 Server Error when I try to go on the appspot website. Any ideas as to what could be going wrong?
Thanks.
The problem is that your 'clone' application does not have access to Khans Academy's AppEngine datastore so there is no content to display. Even if you do use all of the code for their application, you are still going to have to generate all of your own content.
Even if you are planning to 'clone' their content, too, you are going to have to do a lot of probably manual work to get it in to your application's datastore.
I have a python application that I've been running with the devserver and everything seems to work fine except I am having problems initializing my datastore. Basically I need to set up data store values from a bunch of files that are on my local drive, but I don't want to upload go google. I set up a simple python script inside my app directory that does all of the data creation, but now I'm having a lot of problems deploying my app. How do I get a dump of the data that dev_appserver is using and upload it to my application?
Thanks for any insights.
Download the data using appcfg.py (after enabling the remote_api), then re-'upload' it to local devappserver.
http://blog.mfabrik.com/2011/03/14/mirroring-app-engine-production-data-to-development-server-using-appcfg-py/