google-app-engine

How to get the root directory of my app in google app engine?


I want to point to an file in my deployed app from different source files. For that reason it would be useful to know the root path to my app but I didn't find any env variable.


Solution

  • In Google App Engine, there isn’t a direct environment variable that provides the root directory of your app. However, you can get the root directory of your deployed app in several ways depending on the runtime you're using

    Python example:

    import os
    root_directory = os.path.dirname(os.path.abspath(__file__))