|
26 | 26 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
|
27 | 27 |
|
28 | 28 | # SECURITY WARNING: keep the secret key used in production secret!
|
29 |
| -SECRET_KEY = 'django-insecure-8@ai$vzq04xi!oq#rl6z@8*h8h^7w8u(6n-g+9ptnvjf*#&o$7' |
| 29 | +secrets = secretmanager.SecretManagerServiceClient() |
| 30 | +SECRET_KEY = secrets.access_secret_version( |
| 31 | + name="projects/idyllic-kit-328813/secrets/django_secret_key/versions/latest") |
30 | 32 |
|
31 | 33 | # SECURITY WARNING: don't run with debug turned on in production!
|
32 | 34 | DEBUG = True
|
33 | 35 |
|
34 | 36 | ALLOWED_HOSTS = ["localhost", "127.0.0.1", "idyllic-kit-328813.ew.r.appspot.com"]
|
35 | 37 |
|
36 |
| - |
37 | 38 | # Application definition
|
38 | 39 |
|
39 | 40 | INSTALLED_APPS = [
|
|
94 | 95 | }
|
95 | 96 | }
|
96 | 97 |
|
97 |
| - |
98 | 98 | # Password validation
|
99 | 99 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
|
100 | 100 |
|
|
113 | 113 | },
|
114 | 114 | ]
|
115 | 115 |
|
116 |
| - |
117 | 116 | # Internationalization
|
118 | 117 | # https://docs.djangoproject.com/en/3.2/topics/i18n/
|
119 | 118 |
|
|
123 | 122 | USE_L10N = True
|
124 | 123 | USE_TZ = True
|
125 | 124 |
|
126 |
| - |
127 | 125 | # Static files (CSS, JavaScript, Images)
|
128 | 126 | # https://docs.djangoproject.com/en/3.2/howto/static-files/
|
129 | 127 |
|
130 | 128 | STATIC_URL = '/static/'
|
131 | 129 |
|
132 |
| - |
133 | 130 | # Default primary key field type
|
134 | 131 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
|
135 | 132 |
|
136 | 133 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
137 | 134 |
|
138 |
| - |
139 | 135 | # Certifying Firebase credentials for Firebase integration
|
140 | 136 | # https://jrizmal.medium.com/how-to-authenticate-firebase-users-in-django-rest-framework-c2d90f5a0a11
|
141 | 137 |
|
142 |
| -REST_FRAMEWORK = { |
143 |
| - 'DEFAULT_AUTHENTICATION_CLASSES': [ |
144 |
| - 'FirebaseAuth.authentication.FirebaseAuthentication', |
145 |
| - ] |
146 |
| -} |
| 138 | +# REST_FRAMEWORK = { |
| 139 | +# 'DEFAULT_AUTHENTICATION_CLASSES': [ |
| 140 | +# 'FirebaseAuth.authentication.FirebaseAuthentication', |
| 141 | +# ] |
| 142 | +# } |
147 | 143 |
|
148 | 144 | # Specify your Google API key as environment variable GOOGLE_API_KEY
|
149 | 145 | GOOGLE_API_KEY = os.environ.get('GOOGLE_API_KEY')
|
150 |
| -os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "F:/Projects/AdvancedDevelopment/firebase_admin_sdk.json" |
151 |
| - |
152 |
| -secrets = secretmanager.SecretManagerServiceClient() |
153 |
| - |
154 |
| -try: |
155 |
| - # todo save response to file |
156 |
| - response = secrets.access_secret_version(name="projects/idyllic-kit-328813/secrets/Firebase_Admin_SDK/versions/latest") |
157 |
| - cred = credentials.Certificate(response) |
158 |
| -except PermissionDenied as exception: # todo write to log |
159 |
| - cred = credentials.Certificate(os.path.join(BASE_DIR, "firebase_admin_sdk.json")) |
160 |
| - |
161 |
| -firebase_admin.initialize_app(cred) |
| 146 | +GOOGLE_APPLICATION_CREDENTIALS = os.path.join(BASE_DIR, "firebase_admin_sdk.json") |
| 147 | +os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', |
| 148 | + GOOGLE_APPLICATION_CREDENTIALS) |
| 149 | + |
| 150 | +# try: |
| 151 | +# # todo save response to file |
| 152 | +# response = secrets.access_secret_version( |
| 153 | +# name="projects/idyllic-kit-328813/secrets/Firebase_Admin_SDK/versions/latest") |
| 154 | +# cred = credentials.Certificate(response) |
| 155 | +# except PermissionDenied as exception: # todo write to log |
| 156 | +# cred = credentials.Certificate(os.path.join(BASE_DIR, "firebase_admin_sdk.json")) |
| 157 | +# |
| 158 | +# firebase_admin.initialize_app(cred) |
0 commit comments