File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77BASE_DIR = Path (__file__ ).resolve ().parent .parent
88
9+
910load_dotenv ()
1011SECRET_KEY = os .getenv ("SECRET_KEY" , default = "supersecretkey" )
12+ print (SECRET_KEY )
1113
1214DEBUG = True
1315
5860
5961WSGI_APPLICATION = "bookinn.wsgi.application"
6062
61- DATABASES = {
62- "default" : {
63- "ENGINE" : "django.db.backends.sqlite3" ,
64- "NAME" : BASE_DIR / "db.sqlite3" ,
63+ if os .getenv ("DATABASE_TYPE" ) == "postgresql" :
64+ DATABASES = {
65+ "default" : {
66+ "ENGINE" : os .getenv ("ENGINE" , default = "django.db.backends.postgresql" ),
67+ "NAME" : os .getenv ("NAME" , default = "postgres" ),
68+ "USER" : os .getenv ("USER" , default = "postgres" ),
69+ "PASSWORD" : os .getenv ("PASSWORD" , default = "postgres" ),
70+ "HOST" : os .getenv ("HOST" , default = "localhost" ),
71+ "PORT" : os .getenv ("PORT" , default = "5432" ),
72+ }
6573 }
66- }
74+ else :
75+ DATABASES = {
76+ "default" : {
77+ "ENGINE" : "django.db.backends.sqlite3" ,
78+ "NAME" : BASE_DIR / "db.sqlite3" ,
79+ }
80+ }
81+
6782
6883AUTH_PASSWORD_VALIDATORS = [
6984 {
You can’t perform that action at this time.
0 commit comments