Forums

Connect to weaviate cluster

Hi there!

Recently I've created a flask app on PythonAnywhere. Now I'm trying to connect the app to a Weaviate cluster, from where it would retrieve data and pass it through to an API (which I still need to build).

I'm receiving errors on the connection part. Such as:

site-packages/weaviate/connect/connection.py", line 653, in wait_for_weaviate
    raise Weaviat`enter code here`eStartUpError(
weaviate.exceptions.WeaviateStartUpError: Weaviate did not start up in 15 seconds. Either the Weaviate URL https://elections-cluster-6o7gff5n.weaviate.network is wrong or Weaviate did not start up in the interval given in 'startup_period'.

In my flask app should authenticate the acces:

auth_config = weaviate.AuthApiKey(api_key=WEAVIATE_API_KEY)

WEAVIATE_URL = WEAVIATE_CLUSTER
client = weaviate.Client(
    url=WEAVIATE_URL,
    additional_headers={"X-OpenAI-Api-Key": OPENAI_API_KEY},
    auth_client_secret=auth_config,
    startup_period = 15
)

Yet this doesn't seem to work.

I'm rather new in this domain of coding, so any general advice on whether this is possible at all would be welcome!

Thanks,

Thomas

Try running the code that connects to weaviate in a console instead of in your web app and see if that changes anything.

This worked, thanks!

Glad to hear that!