Skip to content

Commit

Permalink
Merge 3560450 into 6354370
Browse files Browse the repository at this point in the history
  • Loading branch information
helllllllder committed Aug 18, 2021
2 parents 6354370 + 3560450 commit 5b0bde0
Show file tree
Hide file tree
Showing 14 changed files with 471 additions and 341 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ script:
- python manage.py search_index --rebuild -f
- python manage.py collectstatic
- flake8
- travis_wait coverage run manage.py test --exclude-tag=elastic
- travis_wait coverage run manage.py test --tag=elastic
- travis_wait coverage run manage.py test
after_success:
- coveralls
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y gcc bzip2 git curl nginx libpq-dev gettext \
libgdal-dev python3-cffi python3-gdal vim

RUN pip install -U pip==20.2.2 setuptools==49.6.0
RUN pip install -U pip==21.2.2 setuptools==57.4.0
RUN pip install pipenv==2021.5.29
RUN pip install gunicorn==19.9.0
RUN pip install gevent==1.4.0
Expand Down
42 changes: 21 additions & 21 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,50 @@ verify_ssl = true
name = "pypi"

[packages]
django = "~=2.2.12"
djangorestframework = "~=3.9.3"
django-filter = "~=2.2.0"
django-cors-headers = "~=3.3.0"
django = "~=3.2.6"
djangorestframework = "~=3.12.4"
django-filter = "~=2.4.0"
django-cors-headers = "~=3.7.0"
requests = "~=2.23.0"
coreapi = "~=2.3.3"
whitenoise = "~=5.1.0"
whitenoise = "~=5.3.0"
pytz = "~=2020.1"
drf-yasg2 = "~=1.19.4"
gunicorn = "~=19.9.0"
gevent = "~=1.4.0"
packaging = "~=20.4"
django-environ = "~=0.4.5"
boto3 = "~=1.13.9"
sentry-sdk = "~=0.13.2"
django-environ-2 = "~=2.1.0"
boto3 = "~=1.18.13"
sentry-sdk = "~=1.3.1"
redis = "*"
celery = "~=5.1.2"
django-celery-beat = "~=2.2.1"
django-celery-results = "~=2.2.0"
python-slugify = "~=4.0.0"
openpyxl = "~=3.0.3"
pillow = "~=7.1.2"
pillow = "~=8.3.1"
kombu = "~=5.1.0"
matplot = "~=0.1.9"
django-redis = "~=4.12.1"
elastic-apm = "~=5.9.0"
mozilla-django-oidc = "~=1.2.4"
elastic-apm = "~=6.3.3"
mozilla-django-oidc = "~=2.0.0"
djangorestframework-recaptcha = "~=0.2.0"
djangogrpcframework = "~=0.2"
grpcio = "~=1.34.0"
grpcio-tools = "~=1.34.0"
django-elasticsearch-dsl= "~=7.0.0"
djangogrpcframework = "~=0.2.1"
grpcio = "~=1.39.0"
grpcio-tools = "~=1.39.0"
django-elasticsearch-dsl= "~=7.2.0"
django-elasticsearch-dsl-drf= "~=0.22.1"
elasticsearch= "~=7.0.0"
elasticsearch-dsl= "~=7.0.0"
psycopg2-binary = "~=2.8.6"
elasticsearch= "~=7.14.0"
elasticsearch-dsl= "~=7.4.0"
psycopg2-binary = "~=2.9.1"

[dev-packages]
"flake8" = "*"
"flake8" = "~=3.9.2"
requests-mock = "~=1.8.0"
coverage = "*"
coverage = "~=5.5"
ipython = "*"
autopep8 = "*"
black = "==19.3b0"
black = "==21.7b0"

[requires]
python_version = "3.6"
722 changes: 419 additions & 303 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bothub/api/v2/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,6 @@ class RepositoryNLPLogViewSet(DocumentViewSet):
pagination_class = LimitOffsetPagination
limit = settings.REPOSITORY_NLP_LOG_LIMIT
search_fields = ["text"]

filter_fields = {
"repository_uuid": "repository_uuid",
"language": "language",
Expand All @@ -1132,6 +1131,7 @@ class RepositoryNLPLogViewSet(DocumentViewSet):
"lookups": [LOOKUP_QUERY_LTE, LOOKUP_QUERY_GTE],
},
}
ordering = ('-created_at',)

def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
Expand Down
6 changes: 2 additions & 4 deletions bothub/api/v2/tests/test_logs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import json
import time

from django.core.management import call_command
from django.test import RequestFactory
from django.test import tag
from django.test import TestCase
from django_elasticsearch_dsl.registries import registry
from rest_framework import status

from bothub.api.v2.nlp.views import RepositoryNLPLogsViewSet
Expand Down Expand Up @@ -172,8 +171,7 @@ def setUp(self):
is_default=False,
repository_nlp_log=nlp_log,
)
call_command("search_index", "--rebuild", "-f")
time.sleep(10)
registry.update(nlp_log)

def request(self, data, token=None):
authorization_header = (
Expand Down
14 changes: 14 additions & 0 deletions bothub/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
ASGI config for weni project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "weni.settings")

application = get_asgi_application()
2 changes: 1 addition & 1 deletion bothub/authentication/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class AuthenticationConfig(AppConfig):
name = "authentication"
name = "bothub.authentication"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'bothub/emails/base.html' %}

{% load staticfiles i18n %}
{% load static i18n %}

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
Expand Down
2 changes: 1 addition & 1 deletion bothub/common/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class CommonConfig(AppConfig):
name = "common"
name = "bothub.common"
2 changes: 1 addition & 1 deletion bothub/common/templates/bothub/emails/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load staticfiles i18n %}
{% load static i18n %}
<!doctype html>
<html lang="en">

Expand Down
2 changes: 1 addition & 1 deletion bothub/common/templates/common/emails/new_request.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'bothub/emails/base.html' %}

{% load i18n staticfiles %}
{% load i18n static %}

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'bothub/emails/base.html' %}

{% load i18n staticfiles %}
{% load i18n static %}

{% block before-content %}
<div style="text-align: center; padding-top: 20px;">
Expand Down
9 changes: 6 additions & 3 deletions bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@

STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

# rest framework

Expand Down Expand Up @@ -455,14 +459,13 @@
"SERVER_URL": env("APM_SERVER_URL"),
"ENVIRONMENT": env("APM_SERVICE_ENVIRONMENT"),
"DJANGO_TRANSACTION_NAME_FROM_ROUTE": True,
"PROCESSORS": (
"PROCESSORS": [
"elasticapm.processors.sanitize_stacktrace_locals",
"elasticapm.processors.sanitize_http_request_cookies",
"elasticapm.processors.sanitize_http_headers",
"elasticapm.processors.sanitize_http_wsgi_env",
"elasticapm.processors.sanitize_http_request_querystring",
"elasticapm.processors.sanitize_http_request_body",
),
],
}

SECRET_KEY_CHECK_LEGACY_USER = env.str("SECRET_KEY_CHECK_LEGACY_USER")
Expand Down

0 comments on commit 5b0bde0

Please sign in to comment.