Skip to content

Commit 154f890

Browse files
authored
Setup Python cloud debugger (#219)
* Setup Google Cloud debugger * Add new line * Remove comma * Remove comma part 2 * add logging Signed-off-by: Niket Shah <[email protected]> * turn on secure ssl Signed-off-by: Niket Shah <[email protected]> * add logs for import error case Signed-off-by: Niket Shah <[email protected]> * put import in main Signed-off-by: Niket Shah <[email protected]> * try putting debugging setup in appengine_configpy Signed-off-by: Niket <[email protected]> * put in main.py Signed-off-by: Niket <[email protected]> * define LOGGER Signed-off-by: Niket <[email protected]> * import logging Signed-off-by: Niket <[email protected]> * clean up code Signed-off-by: Niket <[email protected]>
1 parent 4adc6a8 commit 154f890

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

appengine_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Third-party libraries are stored in "lib", vendoring will make
1010
# sure that they are importable by the application.
11-
vendor.add('lib')
11+
vendor.add("lib")
1212

1313
from requests_toolbelt.adapters import appengine
1414

django_site/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
DOTMAILER_DEFAULT_PREFERENCES = json.loads(os.getenv("DOTMAILER_DEFAULT_PREFERENCES", "[]") or "[]")
2929

3030
SECURE_HSTS_SECONDS = 31536000 # One year
31+
SECURE_SSL_REDIRECT = True
3132

3233
# SECURITY WARNING: don't run with debug turned on in production!
3334
DEBUG = False

generate_requirements.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
f"mysqlclient==1.4.*\n"
99
f"redis==3.3.*\n"
1010
f"django-redis==4.11.*\n"
11-
f"django-anymail[amazon_ses]==7.0.*"
11+
f"django-anymail[amazon_ses]==7.0.*\n"
12+
f"google-python-cloud-debugger"
1213
)
1314

1415
requirements_path = "requirements.txt"

main.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
from django_site.wsgi import application
22

3+
try:
4+
import googleclouddebugger
5+
6+
googleclouddebugger.enable()
7+
except ImportError:
8+
pass
9+
310
app = application

manage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import sys
44

5-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
5+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "lib"))
66

77
if __name__ == "__main__":
88
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_site.settings")

0 commit comments

Comments
 (0)