Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[김나래]Homework2 : hello world 출력하기 #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added study/__pycache__/manage.cpython-311.pyc
Binary file not shown.
Binary file added study/db.sqlite3
Binary file not shown.
Empty file added study/myapp1/__init__.py
Empty file.
Binary file added study/myapp1/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added study/myapp1/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file added study/myapp1/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file added study/myapp1/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file added study/myapp1/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added study/myapp1/__pycache__/views.cpython-311.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions study/myapp1/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions study/myapp1/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class Myapp1Config(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'myapp1'
21 changes: 21 additions & 0 deletions study/myapp1/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.2.1 on 2023-05-20 04:49

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='mymodel',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField()),
],
),
]
Empty file.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions study/myapp1/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.db import models

class mymodel(models.Model):
text = models.TextField()
3 changes: 3 additions & 0 deletions study/myapp1/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
8 changes: 8 additions & 0 deletions study/myapp1/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path, include
from .views import HelloAPI

urlpatterns = [

path("hello/", HelloAPI),

]
10 changes: 10 additions & 0 deletions study/myapp1/views.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from rest_framework import viewsets, permissions, generics, status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework.views import APIView

from .models import mymodel

@api_view(['GET'])#get방식
def HelloAPI(request):
return Response("hello world")
Binary file added study/study/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file added study/study/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file added study/study/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file added study/study/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions study/study/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
"myapp1",


]

MIDDLEWARE = [
Expand Down
5 changes: 2 additions & 3 deletions study/study/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

from django.urls import path, include
urlpatterns = [
path("admin/", admin.site.urls),
path('study/', include('myapp1.urls'))
]
Loading