Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous Notification #2388

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b923859
commit 1
HanilJain Jun 29, 2024
4a2a6dc
commit 2
HanilJain Jun 29, 2024
d1c914e
commit
HanilJain Jul 1, 2024
3ecfeaf
notification working
HanilJain Jul 1, 2024
e725cf1
redis removed
HanilJain Jul 1, 2024
5dfd532
mem channel added
HanilJain Jul 1, 2024
cee5e5a
Merge branch 'main' into async_project
HanilJain Jul 1, 2024
589d25c
poetry update
HanilJain Jul 1, 2024
d7e3ed6
shifted to website app
HanilJain Jul 1, 2024
fa53157
pre-commit
HanilJain Jul 1, 2024
be388dd
Merge branch 'main' into async_project
DonnieBLT Jul 2, 2024
df73ca7
Apply suggestions from code review
HanilJain Jul 3, 2024
4920eff
Merge branch 'main' into async_project
HanilJain Jul 3, 2024
0dbfb52
Merge branch 'main' into async_project
HanilJain Jul 4, 2024
585b69f
comments revoked
HanilJain Jul 4, 2024
dbf2162
Merge branch 'async_project' of https://github.com/HanilJain/BLT into…
HanilJain Jul 4, 2024
da192ae
Merge branch 'main' into async_project
HanilJain Jul 13, 2024
74065bd
Merge branch 'main' into async_project
HanilJain Jul 16, 2024
5f3caab
Merge branch 'main' into async_project
HanilJain Jul 16, 2024
10d4857
Merge branch 'main' into async_project
HanilJain Sep 18, 2024
50103d4
Merge branch 'main' into async_project
HanilJain Sep 27, 2024
02161d5
Merge branch 'main' into async_project
HanilJain Oct 24, 2024
51aff8c
upgrade
HanilJain Oct 28, 2024
fdd96da
dep removed 1
HanilJain Oct 28, 2024
8463320
pusher integrates
HanilJain Oct 29, 2024
48b5a48
pusher added
HanilJain Oct 29, 2024
3896e16
Merge branch 'main' into async_project
HanilJain Oct 29, 2024
7cdc3c1
pusher removed
HanilJain Oct 29, 2024
210f1fe
Merge branch 'async_project' of https://github.com/HanilJain/BLT into…
HanilJain Oct 29, 2024
74376f4
updating requirements.txt
HanilJain Oct 29, 2024
95008bb
restore .gitignore
HanilJain Oct 29, 2024
ea7ed9e
update requirements.txt
HanilJain Oct 29, 2024
ef0e6c8
removed vagrant
HanilJain Oct 30, 2024
c5adccd
Merge branch 'main' into async_project
HanilJain Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ RUN apt-get update && apt-get install -y \

RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry lock --no-update
RUN poetry install

RUN python manage.py migrate
RUN python manage.py loaddata website/fixtures/initial_data.json
# RUN python manage.py collectstatic
RUN python manage.py initsuperuser

28 changes: 28 additions & 0 deletions blt/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
ASGI config for channels_celery_project 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

import django

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "blt.settings")
django.setup()

from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application

from website.routing import websocket_urlpatterns

application = ProtocolTypeRouter(
{
"http": get_asgi_application(),
"websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)),
}
)
27 changes: 22 additions & 5 deletions blt/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
# Application definition

INSTALLED_APPS = (
"daphne",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this

"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
Expand Down Expand Up @@ -197,6 +198,15 @@

WSGI_APPLICATION = "blt.wsgi.application"

ASGI_APPLICATION = "blt.asgi.application"

CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer",
},
}


# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

Expand Down Expand Up @@ -317,6 +327,7 @@
"0.0.0.0",
"blt.owasp.org",
"." + DOMAIN_NAME_PREVIOUS,
"blt.onrender.com",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this

]

# Static files (CSS, JavaScript, Images)
Expand Down Expand Up @@ -511,11 +522,17 @@

# Twitter

BEARER_TOKEN = os.environ.get("BEARER_TOKEN")
APP_KEY = os.environ.get("APP_KEY")
APP_KEY_SECRET = os.environ.get("APP_KEY_SECRET")
ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN")
ACCESS_TOKEN_SECRET = os.environ.get("ACCESS_TOKEN_SECRET")
# BEARER_TOKEN = os.environ.get("BEARER_TOKEN")
# APP_KEY = os.environ.get("APP_KEY")
# APP_KEY_SECRET = os.environ.get("APP_KEY_SECRET")
# ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN")
# ACCESS_TOKEN_SECRET = os.environ.get("ACCESS_TOKEN_SECRET")
HanilJain marked this conversation as resolved.
Show resolved Hide resolved

BEARER_TOKEN = "AAAAAAAAAAAAAAAAAAAAACY4swEAAAAACCwbesyUMRhqJcZ5IQKJ%2FeAWpYY%3DWhxvFboQKFlJtKIJ1WWlL2fWYzKSfF383NMBsgRFTg9h8Y5jBF"
APP_KEY = "hBSe9kWzsWvrZTjbm5326j9TE"
APP_KEY_SECRET = "mbHK5fNCkIppsO8ErswLzGDXMdRS74XltkHmnFF2WXtxB60AIE"
ACCESS_TOKEN = "1562852714412793857-CHEfVrO4shDhoWJOsBNCN7Z0d0d3Kw"
ACCESS_TOKEN_SECRET = "jKfqv8FaIuYcyYdy6jdGprh2WHJtonR4ziHgETkC81hYq"
HanilJain marked this conversation as resolved.
Show resolved Hide resolved

# USPTO

Expand Down
2 changes: 2 additions & 0 deletions blt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
BugHuntApiViewsetV2,
CompanyViewSet,
DomainViewSet,
FetchNotificationApiView,
FlagIssueApiView,
InviteFriendApiViewset,
IssueViewSet,
Expand Down Expand Up @@ -358,6 +359,7 @@
InviteFriendApiViewset.as_view(),
name="api_invite_friend",
),
path("api/notification/", FetchNotificationApiView.as_view(), name="notification"),
re_path(r"^scoreboard/$", ScoreboardView.as_view(), name="scoreboard"),
re_path(r"^issue/$", IssueCreate.as_view(), name="issue"),
re_path(
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: "3"

services:
app:
command: "poetry run python manage.py runserver 0.0.0.0:8000"
command: "poetry run uvicorn blt.asgi:application --host 0.0.0.0 --port 8000"
build: .
volumes:
- .:/blt
ports:
- "8000:8000"
- "8000:8000"
Loading
Loading