add chat box

This commit is contained in:
Dinh 2020-01-27 14:37:52 -06:00
parent 15b0e06a4f
commit af61e8a8e8
15 changed files with 175 additions and 6 deletions

13
dmoj/routing.py Normal file
View file

@ -0,0 +1,13 @@
import chat_box.routing
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
application = ProtocolTypeRouter({
# (http->django views is added by default)
'websocket': AuthMiddlewareStack(
URLRouter(
chat_box.routing.websocket_urlpatterns,
),
),
})

View file

@ -236,6 +236,8 @@ INSTALLED_APPS += (
'statici18n',
'impersonate',
'django_jinja',
'chat_box',
'channels',
)
MIDDLEWARE = (
@ -500,3 +502,13 @@ TESTCASE_VISIBLE_LENGTH = 60
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
ASGI_APPLICATION = 'dmoj.routing.application'
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('0.0.0.0', 6379)],
},
},
}

View file

@ -1,3 +1,4 @@
from chat_box.views import chat
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
@ -14,10 +15,9 @@ from judge.feed import AtomBlogFeed, AtomCommentFeed, AtomProblemFeed, BlogFeed,
from judge.forms import CustomAuthenticationForm
from judge.sitemap import BlogPostSitemap, ContestSitemap, HomePageSitemap, OrganizationSitemap, ProblemSitemap, \
SolutionSitemap, UrlSitemap, UserSitemap
from judge.views import TitledTemplateView, api, blog, comment, contests, language, license, mailgun, organization, \
preview, problem, problem_manage, ranked_submission, register, stats, status, submission, tasks, ticket, totp, \
user, widgets
from judge.views.about import about, custom_checker_sample
from judge.views import TitledTemplateView, about, api, blog, comment, contests, language, license, mailgun, \
organization, preview, problem, problem_manage, ranked_submission, register, stats, status, submission, tasks, \
ticket, totp, user, widgets
from judge.views.problem_data import ProblemDataView, ProblemSubmissionDiff, \
problem_data_file, problem_init_view
from judge.views.register import ActivationView, RegistrationView
@ -25,6 +25,7 @@ from judge.views.select2 import AssigneeSelect2View, CommentSelect2View, Contest
ContestUserSearchSelect2View, OrganizationSelect2View, ProblemSelect2View, TicketUserSelect2View, \
UserSearchSelect2View, UserSelect2View
admin.autodiscover()
register_patterns = [
@ -362,9 +363,11 @@ urlpatterns = [
url(r'^progress$', tasks.demo_progress),
])),
url(r'^about/', about, name='about'),
url(r'^about/', about.about, name='about'),
url(r'^custom_checker_sample', custom_checker_sample, name='custom_checker_sample'),
url(r'^custom_checker_sample/', about.custom_checker_sample, name='custom_checker_sample'),
url(r'chat/', chat, name='chat'),
]
favicon_paths = ['apple-touch-icon-180x180.png', 'apple-touch-icon-114x114.png', 'android-chrome-72x72.png',