Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,49 @@ | ||
{ | ||
"name": "{{ cookiecutter.project_name }}", | ||
"env": { | ||
"ALLOWED_HOSTS": { | ||
"value": ".herokuapp.com" | ||
}, | ||
"DEBUG": { | ||
"value": "True" | ||
}, | ||
"DISABLE_COLLECTSTATIC": { | ||
"value": 1 | ||
}, | ||
"ENVIRONMENT": { | ||
"value": "development" | ||
}, | ||
"PROJECT_PATH": { | ||
"value": "{{ cookiecutter.project_slug }}" | ||
}, | ||
"NPM_CONFIG_PRODUCTION": { | ||
"value": "false" | ||
}, | ||
"SECRET_KEY": { | ||
"generator": "secret" | ||
} | ||
"name": "{{ cookiecutter.project_name }}", | ||
"env": { | ||
"ALLOWED_HOSTS": { | ||
"value": ".herokuapp.com" | ||
}, | ||
"addons": [ | ||
"heroku-postgresql:standard-0", | ||
"DEBUG": { | ||
"value": "True" | ||
}, | ||
"DISABLE_COLLECTSTATIC": { | ||
"value": 1 | ||
}, | ||
"ENVIRONMENT": { | ||
"value": "development" | ||
}, | ||
"PROJECT_PATH": { | ||
"value": "{{ cookiecutter.project_slug }}" | ||
}, | ||
"NPM_CONFIG_PRODUCTION": { | ||
"value": "false" | ||
}, | ||
"SECRET_KEY": { | ||
"generator": "secret" | ||
} | ||
}, | ||
"addons": [ | ||
"heroku-postgresql:standard-0", | ||
"papertrail:Choklad" | ||
], | ||
"environments": { | ||
"review": { | ||
"addons": [ | ||
"heroku-postgresql:mini", | ||
"papertrail:Choklad" | ||
], | ||
"environments": { | ||
"review": { | ||
"addons": [ | ||
"heroku-postgresql:mini", | ||
"papertrail:Choklad" | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/nodejs" | ||
}, | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/nodejs" | ||
}, | ||
{ | ||
"url": "heroku/python" | ||
} | ||
], | ||
"scripts": { | ||
"postdeploy": "./scripts/db_setup.sh" | ||
{ | ||
"url": "heroku/python" | ||
} | ||
], | ||
"scripts": { | ||
"postdeploy": "./scripts/db_setup.sh" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from django.conf import settings | ||
from django.conf.urls.static import static | ||
from django.urls import include, path, re_path | ||
from drf_yasg import openapi | ||
from drf_yasg.views import get_schema_view | ||
from rest_framework import permissions | ||
from rest_framework_nested import routers | ||
|
||
from {{ cookiecutter.project_slug }}.common import views as common_views | ||
from {{ cookiecutter.project_slug }}.core import urls as core_urls | ||
|
||
router = routers.SimpleRouter() | ||
if settings.DEBUG: | ||
router = routers.DefaultRouter() | ||
|
||
# extend url patterns here | ||
urlpatterns = [*core_urls.urlpatterns] | ||
|
||
schema_view = get_schema_view( | ||
openapi.Info( | ||
title="njc API", | ||
default_version="1.0", | ||
description="njc Docs", | ||
terms_of_service="https://www.google.com/policies/terms/", | ||
contact=openapi.Contact(email="support@njc.com"), | ||
license=openapi.License(name="BSD License"), | ||
), | ||
public=False, | ||
permission_classes=[permissions.IsAuthenticated], | ||
) | ||
|
||
urlpatterns = urlpatterns + [ | ||
re_path(r"^api/swagger(?P<format>\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"), | ||
path(r"api/docs/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), | ||
path(r"api/swagger/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"), | ||
path(r"api/redoc/", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"), | ||
] | ||
if settings.DEBUG: # pragma: no cover | ||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) | ||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) | ||
urlpatterns += [path("api-auth/", include("rest_framework.urls"))] | ||
|
||
urlpatterns += [ | ||
re_path(r".*", common_views.index), | ||
] |
28 changes: 28 additions & 0 deletions
28
{{cookiecutter.project_slug}}/server/{{cookiecutter.project_slug}}/common/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% if cookiecutter.client_app == "Vue3" -%} | ||
from django.shortcuts import render | ||
from django.template.exceptions import TemplateDoesNotExist | ||
{% endif %} | ||
{% if cookiecutter.use_graphql == 'y' -%} | ||
from django.template.response import TemplateResponse | ||
from django.views.decorators.cache import never_cache | ||
from django.views.decorators.csrf import ensure_csrf_cookie | ||
{% endif -%} | ||
|
||
|
||
{% if cookiecutter.use_graphql == 'y' %} | ||
|
||
# Serve React frontend | ||
@ensure_csrf_cookie | ||
@never_cache | ||
def index(request): | ||
return TemplateResponse(request, ["index.html", "core/index-placeholder.html"]) | ||
{% elif cookiecutter.client_app.lower() == 'None' -%} | ||
def index(request): | ||
return redirect(to="/docs/swagger/") | ||
{% else %} | ||
def index(request): | ||
try: | ||
return render(request, "index.html") | ||
except TemplateDoesNotExist: | ||
return render(request, "core/index-placeholder.html") | ||
{% endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters