


Connect to Google Cloud Datastore using dev_appserver.py and google.golang.org/
php editor Strawberry will introduce you how to use dev_appserver.py and google.golang.org/ to connect to Google Cloud Datastore. dev_appserver.py is a development server that can simulate the Google App Engine environment, while google.golang.org/ is an official code library of the Go language. Using the two together, you can easily connect to Google Cloud Datastore and read and write data. In this article, we will explain the specific steps in detail to help you get started quickly and successfully connect to Google Cloud Datastore.
Question content
Just as the title says. We have an older Go 1.11 AppEngine API that requires dev_appserver.py
to run. In short, I want appengine.Main()
and appengine.NewContext(r)
to allow my application to point to me using my project-id
Cloud data storage instead of local simulator storage. I set GOOGLE_APPLICATION_CREDENTIALS
to no avail.
This way I can run the server locally while accessing the shared cloud database.
I'm using google.golang.org/[email protected]
and dev_appserver.py --enable_console --port=8081 --support_datastore_emulator=true --go_debugging=true app.yaml
is it possible? Or am I stuck on the local emulator when using the old Go library?
Solution
Move from comments to answers
-
View go 1.11’s
remote_api
https://www.php.cn/link/2d680487650d66445b50d3d759eccad4 -
The logic of using it is similar to -
If running in local environment, use
remote_api
Otherwise stick to default behavior (i.e. sinceremote_api
is not enabled, it will use emulator in local environment or directly in production Using production data)For simplicity, you can try using the same variable name, i.e.
if this is local environment ctx, err := remote_api.NewRemoteContext(host, hc) else ctx := appengine.NewContext(r)
Copy after loginYou then use "ctx" in the rest of your queries/calls to the datastore
NOTE: I am not familiar with "go" so consider the above as pseudocode rather than working code
-
You may also want to consider running the above changes without the
--support_datastore_emulator=true
flag
The above is the detailed content of Connect to Google Cloud Datastore using dev_appserver.py and google.golang.org/. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The jojplay simulator is a very easy-to-use mobile phone simulator. It supports computer games to run on mobile phones and has very good compatibility. Some players don’t know how to use it. The editor below will introduce how to use it. How to use joiplay simulator 1. First, you need to download the Joiplay body and RPGM plug-in. It is best to install them in the order of body-plug-in. The apk package can be obtained in the Joiplay bar (click to get >>>). 2. After Android is completed, you can add games in the lower left corner. 3. Fill in the name casually, and press CHOOSE on executablefile to select the game.exe file of the game. 4. Icon can be left blank or you can choose your favorite picture.

How to enable VT on MSI motherboard? What are the methods? This website has carefully compiled the MSI motherboard VT enable methods for the majority of users. Welcome to read and share! The first step is to restart the computer and enter the BIOS. What should I do if the startup speed is too fast and I cannot enter the BIOS? After the screen lights up, keep pressing "Del" to enter the BIOS page. The second step is to find the VT option in the menu and turn it on. Different models of computers have different BIOS interfaces and different names for VT. Situation 1: 1. Enter After entering the BIOS page, find the "OC (or overclocking)" - "CPU Features" - "SVMMode (or Intel Virtualization Technology)" option and change the "Disabled"

How to enable VT on ASRock motherboard, what are the methods and how to operate it. This website has compiled the ASRock motherboard vt enable method for users to read and share! The first step is to restart the computer. After the screen lights up, keep pressing the "F2" key to enter the BIOS page. What should I do if the startup speed is too fast and I cannot enter the BIOS? The second step is to find the VT option in the menu and turn it on. Different models of motherboards have different BIOS interfaces and different names for VT. 1. After entering the BIOS page, find "Advanced" - "CPU Configuration (CPU) Configuration)" - "SVMMOD (virtualization technology)" option, change "Disabled" to "Enabled"

It can provide users with a better gaming experience and usage experience. An Android emulator is a software that can simulate the running of the Android system on a computer. There are many kinds of Android emulators on the market, and their quality varies, however. To help readers choose the emulator that suits them best, this article will focus on some smooth and easy-to-use Android emulators. 1. BlueStacks: Fast running speed. With excellent running speed and smooth user experience, BlueStacks is a popular Android emulator. Allowing users to play a variety of mobile games and applications, it can simulate Android systems on computers with extremely high performance. 2. NoxPlayer: Supports multiple openings, making it more enjoyable to play games. You can run different games in multiple emulators at the same time. It supports

How to flash the Windows system on BBK tablet? The first way is to install the system on the hard disk. As long as the computer system does not crash, you can enter the system and download things, you can use the computer hard drive to install the system. The method is as follows: Depending on your computer configuration, you can install the WIN7 operating system. We choose to download Xiaobai's one-click reinstallation system in vivopad to install it. First, select the system version suitable for your computer, and click "Install this system" to next step. Then we wait patiently for the installation resources to be downloaded, and then wait for the environment to be deployed and restarted. The steps to install win11 on vivopad are: first use the software to check whether win11 can be installed. After passing the system detection, enter the system settings. Select the Update & Security option there. Click

Life Restart Simulator is a very interesting simulation game. This game has become very popular recently. There are many ways to play in the game. Below, the editor has brought you a complete guide to Life Restart Simulator. Come and take a look. What strategies are there? Life Restart Simulator Guide Guide Features of Life Restart Simulator This is a very creative game in which players can play according to their own ideas. There are many tasks to complete every day, and you can enjoy a new life in this virtual world. There are many songs in the game, and all kinds of different lives are waiting for you to experience. Life Restart Simulator Game Contents Talent Card Drawing: Talent: You must choose the mysterious small box to become an immortal. A variety of small capsules are available to avoid dying midway. Cthulhu may choose

The jojplay simulator can actually customize the game fonts, and can solve the problem of missing characters and boxed characters in the text. I guess many players still don’t know how to operate it. The following editor will bring you the method of setting the font of the jojplay simulator. introduce. How to set the joiplay simulator font 1. First open the joiplay simulator, click on the settings (three dots) in the upper right corner, and find it. 2. In the RPGMSettings column, click to select the CustomFont custom font in the third row. 3. Select the font file and click OK. Be careful not to click the "Save" icon in the lower right corner, otherwise the default settings will be restored. 4. Recommended Founder and Quasi-Yuan Simplified Chinese (already in the folders of the games Fuxing and Rebirth). joi

You can use the command line or other software (such as PuTTY, Putty for Android, iTerm2) to open the Telnet command. In the command line, type "telnet" and press Enter to open, then use "telnet [hostname or IP address] [port]" to connect to the remote device. After a successful connection, you can see the command prompt of the remote device.
