Added static files URL for runserver-level/best performance

* The reason there was a degraded performance was because we're using Gunicorn itself as a local tester. So we needed to add the staticfiles urls
This commit is contained in:
Andrew-Chen-Wang 2020-03-24 20:59:28 -04:00
parent 125ffec243
commit e6b800d985

View File

@ -7,6 +7,9 @@ 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"),
@ -20,6 +23,11 @@ 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 settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
{% endif %}
{% if cookiecutter.use_drf == 'y' -%}
# API URLS
urlpatterns += [