What is my local database's connection string. Postgres/Django/Render

I am doing the tutorial and it says i need to add my local databases connection string to update the database url. I successfully added a different Django project via your tutorial to render. What i need to do now is add this project to render GitHub - JonDevOps/djangox: Django starter project with 🔋
and i am following this tutorial
Deploy a Django App on Render – Render Docs
i am on step 2 in the section titled “updating an existing django project”.

I made the first modification in step 2 to import a database url at the beginning of the file, but on the 2nd section in the comments i get lost when it says# Replace this value with your local database’s connection string.

My question is:
What is that and how do i find it

# Replace the SQLite DATABASES configuration with PostgreSQL:
DATABASES = {
    'default': dj_database_url.config(        # Replace this value with your local database's connection string.        default='postgresql://postgres:postgres@localhost:5432/mysite',        conn_max_age=600    )}

Basically only thing ive done to the django project is fork it and clone it locally. and created an virtualenv. Ive done the first step of this tutorial but ive never created a database even though ive downloaded postgres for other projects. Ive run migrate on other projects but so far on this current djangox project i have not run it yet, because im making a fresh project to test deploying it with render.

Hi there,

This should be your local Postgres services connection URL. This is so that when you run locally, your service will default to connecting to your local Postgres. When running on Render, you would set the DATABASE_URL environment variable to point to your Render Postgres service, which overrides this default value.

Note you can actually remove this line. This would mean you always have to set DATABASE_URL when running your service. This is what the dj_database_url module gives using DATABASE_URL to configure which database your service points to: https://pypi.org/project/dj-database-url/

Regards,

Keith
Render Support, UTC+10 :australia:

1 Like

Ive been banging my head on the keyboard and defaulted to literally just doing the official postgres tutorial to see if i could find the answer there which honestly has been nice haha. Im new but im surprised on how little information is on the internet in regards to the answer i need. Lol when i google my question this post i posted 3 days ago was the first article to pop up.

Ill reiterate because im kinda slow sometimes, like reaaaaal slow, some people might call it retarded but i like to think i have a bit more sense than that.

tldr
my question:
im on this tutorial Deploy a Django App on Render – Render Docs
on step 2 (let me refrain from bashing my head in…)

what does this mean and how do i find the appropriate values to fill in the blanks if i created the databse with you guys on your paas

 Replace the SQLite DATABASES configuration with PostgreSQL:
DATABASES = {
    'default': dj_database_url.config(        # Replace this value with your local database's connection string.        default='postgresql://postgres:postgres@localhost:5432/mysite',        conn_max_age=600    )}

what is my connection string
how do i find the values to properly connect my databse if i created the postgresql databaase on your platform.

# Replace this value with your local database's connection string.  
default='postgresql://postgres:postgres@localhost:5432/mysite',        conn_max_age=600    )}

what do i change :sob: :sob: :sob:

here is my django code template i forked from wsvincents djangox repo GitHub - JonDevOps/djangox: Django starter project with 🔋

do i change the localhost, do i change 532 do i change mysite?
i tried creating your guys app but id==t didnt come tobgether either and i ended up just going to the github repo and clicking on the deploy django site from here button that was in the readme but i dont want to use that template and i dont think thats the proper way to deploy my future projects in the future if i can ever get past this step? Does render have paid customer support i can pay for?

i dont know what to do and i might throw my laptop in a lake or just use something else if i cant make it past the second part of the very first step of the tutorial. ive never had to worry about databases with namecheap before for my static sites so this is a new experience thats painfully slow and feels like peeling nails with tweezers to get answers because im to stiupid to find the answer myself. sorry for ranting and thank you for any help you can provide

can you break down what each step to this string of alien gibberish means and where i can find the info and what each piece means and where in your platform i can find it.
the deployment tutorial isnt hard i just feel like its missing pieces like this for people who arent use to doing full devops which is why we are using the tutorial

sometimes i hate my life for asking questions, its embarrassing

Hi there,

As I already said above, to connect to your Render Postgres database, you set this by setting the DATABASE_URL. Step 2 is to configure it for your local Postgres database, which you said you don’t use. Therefore, you can remove this line altogether. This part of the guide is for configuring your service to work locally.

How to configure it for Render comes down in the deployment section, later in the guide. This is where we refer to the DATABASE_URL.

Regards,
Keith
Render Support, UTC+10 :australia:

1 Like

I litereally just got all the db info off the postgres db on render and then put ot in chat gpt and then asked chatgpt to fill oin the blanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.