mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-02-03 13:14:28 +03:00
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:
parent
125ffec243
commit
e6b800d985
|
@ -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 += [
|
||||
|
|
Loading…
Reference in New Issue
Block a user