Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Simple GAE app with Firestore Emulator

This is an example of a simple Flask GAE app with a Firestore Emulator.



Install the necessary libraries using this command:

pip install -r requirements.txt

Using a virtual environment is strongly encouraged!

Running the emulator and the web app via (RECOMMENDED)

This has only been tested on Mac so far. Not sure if it's working on Linux or Windows.

The easiest way to run the web app is via the script. Right click it in PyCharm and select Run 'run'.

Alternatively, you can run it via the Terminal:


In this case you'll have to shut it down using CTRL+C combo.

This script also allows you to run tests (it asks you at the beginning).

Running the emulator and web app manually (without

If the script does not work on your computer, you'll have to run the Emulator and the web app manually.

Run the Firestore emulator

First run the firestore emulator:

gcloud beta emulators firestore start --project test --host-port "localhost:8001"

Notice that the 8001 port has been used. This is for running the web app. To run tests, use port 8002.

Run the web app.

Next, run the web app. Right-click on and select Run 'main'. Your web app will now be accessible via localhost:8080. Whenever you'll make any change in your code, make sure to reload the web app via this button:

To shut down the web app click the red square icon below the reload button.

Alternatively, you can run the web app via the Terminal with this command:


In this case you'll have to shut it down using CTRL+C combo.

Or, if you'd like to use Flask's auto-reloading features, run the web app with these two commands:

flask run --host localhost --port 8080 --reload

This will automatically reload your app whenever you make any changes in your Python files.

Properly shutting down the Firestore Emulator (if not using

The easiest way to shut down the Firestore Emulator is to properly shut down the Terminal window:

If you fail to do that and your emulator is still running in the background, you'll have to locate its process and "kill" it via the Terminal:

sudo lsof -i:8001  # finds the process running on port 8001 (emulator)

When you run the command written above it will give you the ID of the process. In order to shutdown the process run this:

kill ID  # if the ID is 12345, run "kill 12345"

Localhost logging

The default logging level in Flask is warning, so use this lines for logging:

logging.warning("logging text")

Alternatively, you can change Flask logging settings to allow lower logging levels to show up on localhost.

Deployment to GAE

See these instructions.


Please create a new issue in case there's some bug or something should be improved.

Happy to receive pull requests, too! :)

You can’t perform that action at this time.