add new project
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from channels.routing import ProtocolTypeRouter
|
||||
from django.urls import re_path
|
||||
from channels.routing import URLRouter
|
||||
from channels.http import AsgiHandler
|
||||
from channels.auth import AuthMiddlewareStack
|
||||
import django_eventstream
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'^events/',
|
||||
AuthMiddlewareStack(URLRouter(django_eventstream.routing.urlpatterns)),
|
||||
{'channels': ['notice']}),
|
||||
re_path(r'', AsgiHandler),
|
||||
]
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
'http' : URLRouter(urlpatterns)
|
||||
})
|
||||
+9
-1
@@ -31,12 +31,17 @@ ALLOWED_HOSTS = []
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'posts.apps.PostsConfig',
|
||||
'rest_framework',
|
||||
'channels',
|
||||
'django_eventstream',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
@@ -47,6 +52,8 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django_grip.GripMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'news1.urls'
|
||||
@@ -69,6 +76,7 @@ TEMPLATES = [
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'news1.wsgi.application'
|
||||
ASGI_APPLICATION = 'news1.routing.application'
|
||||
|
||||
|
||||
# Database
|
||||
@@ -104,7 +112,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = 'de-de'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
|
||||
+5
-1
@@ -15,8 +15,12 @@ Including another URLconf
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path,include
|
||||
from posts import views
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('posts/', include('posts.urls'))
|
||||
path('posts/', include('posts.urls')),
|
||||
path('new', views.new, name='new'),
|
||||
|
||||
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user