Skip to content

Commit

Permalink
Upgrade pillow. Add sentry integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfs committed Sep 8, 2021
1 parent 495b834 commit 922dc5c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion parsifal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from parsifal.utils.version import get_version

VERSION = (2, 0, 1, "final", 0)
VERSION = (2, 0, 2, "final", 0)

__version__ = get_version(VERSION)
7 changes: 6 additions & 1 deletion parsifal/apps/core/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from django.conf import settings as django_settings

import parsifal


def settings(request):
return {
"environment": django_settings.PARSIFAL_ENVIRONMENT,
"parsifal_version": parsifal.__version__,
"parsifal_release": django_settings.PARSIFAL_RELEASE,
"parsifal_environment": django_settings.PARSIFAL_ENVIRONMENT,
"recaptcha_enabled": django_settings.GOOGLE_RECAPTCHA_ENABLED,
"recaptcha_site_key": django_settings.GOOGLE_RECAPTCHA_SITE_KEY,
"google_analytics_ua": django_settings.GOOGLE_ANALYTICS_UA,
"sentry_dsn": django_settings.SENTRY_DSN,
}
1 change: 1 addition & 0 deletions parsifal/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
GOOGLE_RECAPTCHA_SITE_KEY = config("GOOGLE_RECAPTCHA_SITE_KEY", default="")
GOOGLE_RECAPTCHA_SECRET_KEY = config("GOOGLE_RECAPTCHA_SECRET_KEY", default="")

SENTRY_DSN = config("SENTRY_DSN", default="")

# ==============================================================================
# FIRST-PARTY APP
Expand Down
2 changes: 1 addition & 1 deletion parsifal/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# ==============================================================================

sentry_sdk.init(
dsn=config("SENTRY_DSN", default=""),
dsn=SENTRY_DSN,
environment=PARSIFAL_ENVIRONMENT,
release=PARSIFAL_RELEASE,
integrations=[DjangoIntegration()],
Expand Down
35 changes: 26 additions & 9 deletions parsifal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,33 @@
<link href="{% static 'css/parsifal.css' %}" rel="stylesheet">
{% endcompress %}
{% block stylesheet %}{% endblock %}
{% if environment == "production" and google_analytics_ua %}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_ua }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ google_analytics_ua }}'{% if user.is_authenticated %}, {'user_id': '{{ user.pk }}'}{% endif %});
</script>

{% if parsifal_environment == "production" %}
{% if google_analytics_ua %}
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ google_analytics_ua }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ google_analytics_ua }}'{% if user.is_authenticated %}, {'user_id': '{{ user.pk }}'}{% endif %});
</script>
{% endif %}

{% if sentry_dsn %}
<!-- Sentry -->
<script src="https://browser.sentry-cdn.com/6.12.0/bundle.min.js" integrity="sha384-S3qfdh3AsT1UN84WIYNuOX9vVOoFg3nB17Jp5/pTFGDBGBt+dtz7MGAV845efkZr" crossorigin="anonymous"></script>
<script>
Sentry.init({
dsn: "{{ sentry_dsn }}",
release: "{{ parsifal_release }}",
environment: "{{ parsifal_environment }}",
integrations: [new Sentry.Integrations.BrowserTracing()]
});
</script>
{% endif %}
{% endif %}

</head>
<body>
<div class="wrapper">
Expand Down
5 changes: 5 additions & 0 deletions parsifal/templates/includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@
<a href="https://youtube.com/ParsifalReviews/" target="_blank" data-toggle="tooltip" title="Youtube" data-placement="top"><span class="fa fa-youtube"></span></a>
</div>
</div>
<div class="row">
<div class="col-xs-12" style="text-align: center; margin-top: -25px;">
<small class="text-muted">v{{ parsifal_version }}</small>
</div>
</div>
</div>
</footer>
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
bleach==4.1.0
bibtexparser==1.2.0
Django==3.2.6
Django==3.2.7
django-compressor==2.4.1
django-crispy-forms==1.12.0
dj-database-url==0.5.0
requests==2.26.0
Pillow==8.3.1
Pillow==8.3.2
psycopg2-binary==2.9.1
python-decouple==3.4
python-docx==0.8.11
Expand Down

0 comments on commit 922dc5c

Please sign in to comment.