From 7cd390854b72abd2c93f46c7a2476890f29cabd8 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Mar 2020 21:42:28 -0400 Subject: [PATCH] Fixed linter checks --- {{cookiecutter.project_slug}}/config/asgi.py | 1 + {{cookiecutter.project_slug}}/config/urls.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/{{cookiecutter.project_slug}}/config/asgi.py b/{{cookiecutter.project_slug}}/config/asgi.py index 3dd31f70..4cc878ca 100644 --- a/{{cookiecutter.project_slug}}/config/asgi.py +++ b/{{cookiecutter.project_slug}}/config/asgi.py @@ -11,6 +11,7 @@ import sys from pathlib import Path from django.core.asgi import get_asgi_application + from .websocket import websocket_application # This allows easy placement of apps within the interior diff --git a/{{cookiecutter.project_slug}}/config/urls.py b/{{cookiecutter.project_slug}}/config/urls.py index 2cf7be95..168d77a8 100644 --- a/{{cookiecutter.project_slug}}/config/urls.py +++ b/{{cookiecutter.project_slug}}/config/urls.py @@ -1,15 +1,15 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin +{%- if cookiecutter.use_async == 'y' %} +from django.contrib.staticfiles.urls import staticfiles_urlpatterns +{%- endif %} from django.urls import include, path from django.views import defaults as default_views from django.views.generic import TemplateView {%- if cookiecutter.use_drf == 'y' %} from rest_framework.authtoken.views import obtain_auth_token {%- endif %} -{%- if cookiecutter.use_async %} -from django.contrib.staticfiles.urls import staticfiles_urlpatterns -{%- endif %} urlpatterns = [ path("", TemplateView.as_view(template_name="pages/home.html"), name="home"), @@ -23,12 +23,12 @@ urlpatterns = [ path("accounts/", include("allauth.urls")), # Your stuff: custom urls includes go here ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) -{% if cookiecutter.use_async %} -# Static file serving when using Gunicorn + Uvicorn for local development +{%- if cookiecutter.use_async == 'y' %} if settings.DEBUG: + # Static file serving when using Gunicorn + Uvicorn for local web socket development urlpatterns += staticfiles_urlpatterns() -{% endif %} -{% if cookiecutter.use_drf == 'y' -%} +{%- endif %} +{% if cookiecutter.use_drf == 'y' %} # API URLS urlpatterns += [ # API base url