프레임워크/Django (5) 썸네일형 리스트형 As a Beginner, going through Django Rest Framework tutorial: #2 1. Serialization Enough of Django basic settings. Now let's move on to the rest framework the very fisrt of which is Serialization. We start by creating a serializer as given in the tutorial # tutorial/snippets/serializers.py from rest_framework import serializers from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES class SnippetSerializer(serializers.Serializer): id = serializer.. As a Beginner, going through Django Rest Framework tutorial: #1 Recently, I happened to start on a project to which I choose to use Django for the backend development. Any reason? Nah... I just felt like it, probably it was because Python was the one I was familiar with the most. In fact, this is my very first project as a developer in my life. Anyway, let's get to the point. I decided to write a series of posts about me as a newbie going through the officia.. Django http When a page is requested, Django creates an HttpRequest object that contains metadata about the request. Then Django loads the appropriate view, passing the HttpRequest as the first argument (request of index function below) to the view function. Each view is responsible for returning an HttpResponse object. # in views.py from djangp.http import HttpResponse def index(request): return HttpRespon.. 장고 모델 Database setup Setting up the database is done by updating the DATABASES variable in settings.py in the project folder. # project_folder/settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } As shown above, SQLite is the default database for which no additional setup is needed. However, any other databases like PostgreSQL.. 장고 (Django) Start a project django-admin startproject project_name # say wqtl Start an app # in the project folder where manage.py is located python manage.py startapp app_name # say ohradical URL dispatcher Upon receiving a http request from a client, Django responds according to the procedure below: check ROOT_URLCONF in settings.py, the value of which becomes the starting point for mapping the given URL .. 이전 1 다음