I am using the community version of pycharm, my hope was to put the sensitive database connection credentials in a separate file in my pycharm project, so if I shared my other files that contain the actual code, they wouldn't have my connection info. Here is what the "connect1.py" file contains:
import psycopg2
# Database Credentials
DB_HOST = "localhost"
DB_NAME = "movie_watchlist1"
DB_USER = "postgres"
DB_PASS = "postgres123"
def database_credentials():
psycopg2.connect(dbname=DB_NAME, user=DB_USER, password=DB_PASS, host=DB_HOST)
pass
Here are the lines in my database.py file that tries to access this information:
import psycopg2
from connect1 import database_credentials
connection = psycopg2.connect(database_credentials())
And here is the error:
TypeError: missing dsn and no parameters
I think the problem is with the "connection = psycopg2.connect(database_credentials())" line, but I haven't been able to figure it out, any help or suggestions would be greatly appreciated.