Creating API from cookiecutter template. #4253
-
Hi all, I want to create an api using django , I just wanted to know what modification do i need to do in cookiecutter template to do so and host the api on aws? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
The Python language itself is an API. Since you mention AWS I assume you want to create a HTTP API? When serving a HTTP API you need some sort of loadbalancer for your app. In this template Traefik routes you http traffic to gunicorn which serves your wsig application. I'm not enough familiar with the AWS ecosystem but I think they have an service for that (Elastic Beanstalk maybe?). This template comes with an HTTP REST API included when using My advice is to start with one thing when learning new things. So if you are new to Python spend some time learning Python. When you are new to Django learn Django. When you have some experience with Python & Django start with the rest framework. Each tool adds a layer of complexity. The cookiecutter template adds a LOT of layers. Each dependency comes with some sort of a configuration and each configuration can go wrong (I learned the hard way spending hours of debugging) so take it easy in the beginning. |
Beta Was this translation helpful? Give feedback.
-
Hey Just wanted to let you know that i successfully configured traefik and everything is working fine now :) |
Beta Was this translation helpful? Give feedback.
The Python language itself is an API. Since you mention AWS I assume you want to create a HTTP API? When serving a HTTP API you need some sort of loadbalancer for your app. In this template Traefik routes you http traffic to gunicorn which serves your wsig application. I'm not enough familiar with the AWS ecosystem but I think they have an service for that (Elastic Beanstalk maybe?).
This template comes with an HTTP REST API included when using
use_drf=yes
, it uses https://www.django-rest-framework.org/ for that. The user app has some API endpoints:cookiecutter-django/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/api/views.py
Lines 13 to 20 in 1cba3b6