From e005538cc39c64a71f470a73de8692de7df4ef84 Mon Sep 17 00:00:00 2001 From: kjg Date: Mon, 29 Jun 2020 23:29:16 +0900 Subject: [PATCH] [Django #1] creat django --- kjg/django/mysite/db.sqlite3 | 0 kjg/django/mysite/manage.py | 21 +++ kjg/django/mysite/mysite/__init__.py | 0 .../__pycache__/__init__.cpython-37.pyc | Bin 0 -> 154 bytes .../__pycache__/settings.cpython-37.pyc | Bin 0 -> 2256 bytes .../mysite/__pycache__/urls.cpython-37.pyc | Bin 0 -> 928 bytes .../mysite/__pycache__/wsgi.cpython-37.pyc | Bin 0 -> 555 bytes kjg/django/mysite/mysite/asgi.py | 16 +++ kjg/django/mysite/mysite/settings.py | 120 ++++++++++++++++++ kjg/django/mysite/mysite/urls.py | 21 +++ kjg/django/mysite/mysite/wsgi.py | 16 +++ kjg/django/mysite/polls/__init__.py | 0 kjg/django/mysite/polls/admin.py | 3 + kjg/django/mysite/polls/apps.py | 5 + .../mysite/polls/migrations/__init__.py | 0 kjg/django/mysite/polls/models.py | 3 + kjg/django/mysite/polls/tests.py | 3 + kjg/django/mysite/polls/urls.py | 7 + kjg/django/mysite/polls/views.py | 3 + kjg/django/mysite/urls.py | 7 + 20 files changed, 225 insertions(+) create mode 100644 kjg/django/mysite/db.sqlite3 create mode 100755 kjg/django/mysite/manage.py create mode 100644 kjg/django/mysite/mysite/__init__.py create mode 100644 kjg/django/mysite/mysite/__pycache__/__init__.cpython-37.pyc create mode 100644 kjg/django/mysite/mysite/__pycache__/settings.cpython-37.pyc create mode 100644 kjg/django/mysite/mysite/__pycache__/urls.cpython-37.pyc create mode 100644 kjg/django/mysite/mysite/__pycache__/wsgi.cpython-37.pyc create mode 100644 kjg/django/mysite/mysite/asgi.py create mode 100644 kjg/django/mysite/mysite/settings.py create mode 100644 kjg/django/mysite/mysite/urls.py create mode 100644 kjg/django/mysite/mysite/wsgi.py create mode 100644 kjg/django/mysite/polls/__init__.py create mode 100644 kjg/django/mysite/polls/admin.py create mode 100644 kjg/django/mysite/polls/apps.py create mode 100644 kjg/django/mysite/polls/migrations/__init__.py create mode 100644 kjg/django/mysite/polls/models.py create mode 100644 kjg/django/mysite/polls/tests.py create mode 100644 kjg/django/mysite/polls/urls.py create mode 100644 kjg/django/mysite/polls/views.py create mode 100644 kjg/django/mysite/urls.py diff --git a/kjg/django/mysite/db.sqlite3 b/kjg/django/mysite/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/kjg/django/mysite/manage.py b/kjg/django/mysite/manage.py new file mode 100755 index 0000000..341863c --- /dev/null +++ b/kjg/django/mysite/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/kjg/django/mysite/mysite/__init__.py b/kjg/django/mysite/mysite/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kjg/django/mysite/mysite/__pycache__/__init__.cpython-37.pyc b/kjg/django/mysite/mysite/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3dbedfbe9a1b2901c5ef5d00fe96121399565ddc GIT binary patch literal 154 zcmZ?b<>g`kg3CXC#)0U^AOZ#$feZ&AE@lA|DGb33nv8xc8Hzx{2;!Hseo=mYiGFEb zdQNI)a)xeBYGP4dW?s5(a%NF-PO5%(R=R#lR$^XyzJ6|Hab`&>jEaxX%*!l^kJl@x Vyv1RYo1apelWGSt{4)?U000zCC=37q literal 0 HcmV?d00001 diff --git a/kjg/django/mysite/mysite/__pycache__/settings.cpython-37.pyc b/kjg/django/mysite/mysite/__pycache__/settings.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e7ac346213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S}edi|9 U<$_R5=BwpGKDo;!#E}hVNmQ zEh{8G09bLICQ^ljG?wCAJJ-kOoO|>9IGa8q173V31YlnzI{|q6?*wP?{kw*Gh{H0@W2Gh9Se) zB0?}qYiqN>n5x{QbVFpJYOOXbw`r~fW)eS4Pq9@s&kc6T7_K)sdhv+}z%q;IqLH~{ zx4X6jy`Q3Ilp-P#7q!xMfzVnjfy6c=b=`07mUnwfpu}pv($K74d$h+>yZ&!O z*S~G(h_^?3#r*2&JMg`m{yf22DT^CfRE+2492!$gaBQA)omUKh+!T0+jCVi8@N%$e Yy=@O42}PTVo!tXWGl41ekNxA(U!C|Q0{{R3 literal 0 HcmV?d00001 diff --git a/kjg/django/mysite/mysite/__pycache__/wsgi.cpython-37.pyc b/kjg/django/mysite/mysite/__pycache__/wsgi.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5d805dfddc84fbdd6799b48a18522b9f1e01177e GIT binary patch literal 555 zcmYjO!EO^V5cN7~6D<@tAkMx>qh-~`DG#i+ zxP-!IX*%)@zSZc!F~0!T-WOVnFB+I|Ot1>&O2eUsHE6aLR&7g0R3O=GChA(NLU@H{ zHj8*~8xpj@l!<)Rw!qLtaOK!sX?V&UK)Ue0cF#GNSh!3sg(-2TslbYZ;m@)ozQ7BQ zTtcmJQ-SgP!j+1rzhgJZc#wq0CHTBK%kRhtPfp$)kB4XZ(V~G HPan|#@*}Ws literal 0 HcmV?d00001 diff --git a/kjg/django/mysite/mysite/asgi.py b/kjg/django/mysite/mysite/asgi.py new file mode 100644 index 0000000..35d925e --- /dev/null +++ b/kjg/django/mysite/mysite/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for mysite project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + +application = get_asgi_application() diff --git a/kjg/django/mysite/mysite/settings.py b/kjg/django/mysite/mysite/settings.py new file mode 100644 index 0000000..6039908 --- /dev/null +++ b/kjg/django/mysite/mysite/settings.py @@ -0,0 +1,120 @@ +""" +Django settings for mysite project. + +Generated by 'django-admin startproject' using Django 3.0.7. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = '2kbmvs@pcbxn)kt#p9$)45=h#i8_b7^^l&l57mbe4%e=+k91-d' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'mysite.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'mysite.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/kjg/django/mysite/mysite/urls.py b/kjg/django/mysite/mysite/urls.py new file mode 100644 index 0000000..8a95eac --- /dev/null +++ b/kjg/django/mysite/mysite/urls.py @@ -0,0 +1,21 @@ +"""mysite URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path + +urlpatterns = [ + path('admin/', admin.site.urls), +] diff --git a/kjg/django/mysite/mysite/wsgi.py b/kjg/django/mysite/mysite/wsgi.py new file mode 100644 index 0000000..dbe7bb5 --- /dev/null +++ b/kjg/django/mysite/mysite/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for mysite project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings') + +application = get_wsgi_application() diff --git a/kjg/django/mysite/polls/__init__.py b/kjg/django/mysite/polls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kjg/django/mysite/polls/admin.py b/kjg/django/mysite/polls/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/kjg/django/mysite/polls/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/kjg/django/mysite/polls/apps.py b/kjg/django/mysite/polls/apps.py new file mode 100644 index 0000000..d0f109e --- /dev/null +++ b/kjg/django/mysite/polls/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PollsConfig(AppConfig): + name = 'polls' diff --git a/kjg/django/mysite/polls/migrations/__init__.py b/kjg/django/mysite/polls/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/kjg/django/mysite/polls/models.py b/kjg/django/mysite/polls/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/kjg/django/mysite/polls/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/kjg/django/mysite/polls/tests.py b/kjg/django/mysite/polls/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/kjg/django/mysite/polls/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/kjg/django/mysite/polls/urls.py b/kjg/django/mysite/polls/urls.py new file mode 100644 index 0000000..88a9cac --- /dev/null +++ b/kjg/django/mysite/polls/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] diff --git a/kjg/django/mysite/polls/views.py b/kjg/django/mysite/polls/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/kjg/django/mysite/polls/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/kjg/django/mysite/urls.py b/kjg/django/mysite/urls.py new file mode 100644 index 0000000..2c2f81b --- /dev/null +++ b/kjg/django/mysite/urls.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from django.urls import include, path + +urlpatterns = [ + path('polls/', include('polls.urls')), + path('admin/', admin.site.urls), +]