feat: make API optional
Add include_api
to the cookiecutter context. If set to NO
then the
api
module won't be included. This is mostly useful for tiny "pure
Django" apps with the traditional request -> render webapp model.
Tweak the logic surrounding adding Django social auth. In general we assume that apps with UI disabled but API enabled are "pure API" applications and don't need social auth. Any other combination results in social auth being added.
Tested by bootstrapping a new Django project for the Regent House Ballot voting site.
Merge request reports
Activity
assigned to @rjw57
requested review from @amc203
58 60 "django.contrib.sessions", 59 61 "django.contrib.messages", 60 {%- if cookiecutter.include_ui == 'YES' %} 61 62 "whitenoise.runserver_nostatic", # use whitenoise even in development 62 {%- endif %} 63 63 "django.contrib.staticfiles", 64 {%- if cookiecutter.include_api == 'YES' %} 64 65 "crispy_forms", 65 66 "django_filters", 66 67 "drf_spectacular", 67 68 "rest_framework", 68 69 "rest_framework.authtoken", 69 {%- if cookiecutter.include_ui == 'YES' %} 70 "social_django", 71 70 {%- endif %} 71 "social_django", I don't think it would ever make sense for pure API backends. There's the rare corner-case of enabling the admin for a pure API app as we're doing in org chart but I'd rather people explicitly have to opt-in for that.
Otherwise we're requiring the faff of making OAuth2 credentials for pure-API applications which are never going to use them.
mentioned in commit 484a381e