Skip to main content

Step 1: To your existing code add:
import mock from flask import Flask from google.cloud import ndb import google.auth.credentials import os

    os.environ["DATASTORE_DATASET"] = "test"
    os.environ["DATASTORE_EMULATOR_HOST"] = "127.0.0.1:8001"
    os.environ["DATASTORE_EMULATOR_HOST_PATH"] = "127.0.0.1:8001/datastore"
    os.environ["DATASTORE_HOST"] = "http://127.0.0.1:8001"
    os.environ["DATASTORE_PROJECT_ID"] = "test"
    
    credentials = mock.Mock(spec=google.auth.credentials.Credentials)

step 1.5 Anywhere you want to test the database add: client = ndb.Client(project="test", credentials=credentials) with client.context():

Alternatively you can use the example project at https://github.com/ReddingSoftware/Google_NDB_Emulator

Step 2: Install google cloud SDK if you haven't already done so https://cloud.google.com/sdk/docs/install

Step3: After navigating to your project folder in your terminal run:

gcloud components install cloud-datastore-emulator

(if you want more on datastore-emulator go to https://cloud.google.com/datastore/docs/tools/datastore-emulator)

Step 4: in your terminal run: pip install ndbviewer

Step 5: add the requirements.txt info to your current requirements.txt and in your terminal run: pip install -r requirements.txt

Step 6: in your terminal run: gcloud beta emulators datastore start --data-dir=. --project test --host-port "127.0.0.1:8001"

Step 7: Open a new terminal but leave the emulator terminal running. This can be done in visual studio code by clicking the plus sign on choosing Terminal and New Terminal.

Step8: Make sure you are still navigated to the NDBEmulator folder in your terminal.

Step 9: in your new terminal run: For mac: export FLASK_APP=main (press return) export FLASK_ENV=development (press return) flask run For PC: set FLASK_APP=main (press return) set FLASK_ENV=development (press return) flask run

 Alternatively, you can run:
    python3 main.py

 or just

    python main.py

For info on how to run Flask from the command line on Visual Studio Code go here https://docs.google.com/document/d/1bbWogGdQ48rMJFB9Wxvtt7XWw5SUfP07BVl6cHk69hk/edit?usp=sharing

Step 10: in your browser go to http://127.0.0.1:5000 (you'll see the main page)

Step 11: add data to your test database. If you don't know how to add data you can use the example project at https://github.com/ReddingSoftware/Google_NDB_Emulator

step12: in your browser go to http://127.0.0.1:5000/ndbviewer

step13: Choose the ndb Kind that you want to view

Metadata

Release files for ndbviewer 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndbviewer 0.0.3
File Size Uploaded Provenance Actions
ndbviewer-0.0.3.tar.gz 4.6 kB Without provenance Details for ndbviewer-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ndbviewer 0.0.3
File Interpreter ABI Platform Actions
ndbviewer-0.0.3-py3-none-any.whl Python 3 none any Details for ndbviewer-0.0.3-py3-none-any.whl

Total release size: 9.5 kB

Release files / ndbviewer-0.0.3.tar.gz

Download URL ndbviewer-0.0.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6e21e2ce2a6fdfb3331a9c93b563fbb3345cfbe173cb6a9803413a0fd435a798
BLAKE2b-256 checksum
How to use checksums
e2d4c1e22165db1a66f24d37a422ea3b48bc5022774bd1cf0d1ce6a3767b9074
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6

Release files / ndbviewer-0.0.3-py3-none-any.whl

Download URL ndbviewer-0.0.3-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c7fb950bc4046dd8ccef1fab4a728d05e47fc9c866d4e7f5e9b4df9d5e5e686
BLAKE2b-256 checksum
How to use checksums
cdda1b1048938584df877665800c817e0f0ff18db42de456ada52206aeec3647
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6

Security for ndbviewer 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page