gpt4 book ai didi

Error : Supabase url is required , Python(错误:需要数据库url,Python)

转载 作者:bug小助手 更新时间:2023-10-22 14:29:20 29 4
gpt4 key购买 nike



I've been faced SupabaseException: supabase_url is required.
Here are codes

我遇到了SuabaseException:需要supabase_url。以下是代码


import os
from supabase import create_client, Client

url: str = os.environ.get('https://mine.supabase.co')
key: str = os.environ.get("xxxxminexxx")
supabase: Client = create_client(url, key)

SupabaseException: supabase_url is required.

SuabaseException:需要supabase_url。


supabase version : 1.0.4
python : 3.10.9

supabase版本:1.0.4 python:3.10.9


i don't know how to deal with this problem.
Plz help.

我不知道如何处理这个问题。请帮忙。



  1. make account supabase https://supabase.com/

  2. pip install supabase

  3. Run code

  4. Error


更多回答

Welcome to Stack Overflow. That isn't how os.environ works. It expects a key: value pair, so whatever your variable your URL is defined as, you get that and not the actual value itself. i.e. if os.environ has URL=http://....", you do a os.environ.get("URL")

欢迎使用堆栈溢出。os.environ不是这样工作的。它需要一个键:值对,所以无论你的URL定义为什么变量,你都会得到它,而不是实际值本身。即如果os.environ有URL=http://....”,您执行os.environ.get(“URL”)

优秀答案推荐

If you are getting the environment variables from the operating system you should be checking for the variable name which you can setup with dotenv python package or a normal export SUPABASE_URL="my-url-to-my-awesome-supabase-instance" and not a url or anon_key as you have in your example. Take a look at the example below which is also outlined in the Supabase Python docs

如果你从操作系统中获取环境变量,你应该检查变量名,你可以用dotenv python包或普通的导出SUPABASE_URL=“我的URL到我的超级数据库实例”来设置,而不是像你的例子中那样的URL或anon_key。看看下面的例子,它也在Suabase Python文档中概述


import os
from supabase import create_client

url = os.environ.get("SUPABASE_URL")
key = os.environ.get("SUPABASE_KEY")
supabase = create_client(url, key)

更多回答

omg Thanks a lot. 😁

omg非常感谢。😁

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com