@app.route("/")defindex():ds=datastore.Client()user_ip=request.remote_addr# Keep only the first two octets of the IP address.ifis_ipv6(user_ip):user_ip=":".join(user_ip.split(":")[:2])else:user_ip=".".join(user_ip.split(".")[:2])entity=datastore.Entity(key=ds.key("visit"))entity.update({"user_ip":user_ip,"timestamp":datetime.datetime.now(tz=datetime.timezone.utc),})ds.put(entity)query=ds.query(kind="visit",order=("-timestamp",))results=[]forxinquery.fetch(limit=10):try:results.append("Time: {timestamp} Addr: {user_ip}".format(**x))exceptKeyError:print("Error with result format, skipping entry.")output="Last 10 visits:\n{}".format("\n".join(results))returnoutput,200,{"Content-Type":"text/plain; charset=utf-8"}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-04-21 UTC。"],[[["Firestore in Datastore mode is a NoSQL document database optimized for server use cases and App Engine, making it ideal for applications primarily used within App Engine."],["Firestore in Native mode is better suited for mobile applications and those requiring real-time notifications, offering a different set of functionalities compared to Datastore mode."],["Using Datastore mode queries often requires defining indexes in an `index.yaml` file, which can be created manually or generated automatically during local testing of your application."],["Developers can use the Datastore mode emulator for local development and testing of applications, allowing for a simulated environment before deployment."],["Comprehensive information on Datastore mode, including optimizations and core concepts, can be found in the Firestore in Datastore mode documentation."]]],[]]