add new project

This commit is contained in:
2019-12-10 15:01:13 +01:00
parent f1eb3bccbd
commit 487a8b5ed2
13 changed files with 182 additions and 7 deletions
+17
View File
@@ -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
View File
@@ -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
View File
@@ -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'),
]