Django_게시판
참고사이트
1)
https://goodthings4me.tistory.com/537
2)
https://seonghyuk.tistory.com/49
3)
https://wikidocs.net/91422
https://wikidocs.net/91422
명령어 List
$ django-admin startproject web_study
cd web_study
python manage.py migrate
py manage.py createsuperuser
-> user name, email, pass 입력
-> admin/admin1
$ python manage.py startapp main
G:\00_django\web01\matDB\matDB
settings.py
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
]
G:\00_django\web01\matDB\templates\main
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
장고 첫페이지!
</body>
</html>
G:\00_django\web01\matDB\main
views.py
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request,'main/index.html')
G:\00_django\web01\matDB\main
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
]
G:\00_django\web01\matDB
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('main.urls')),
]
댓글
댓글 쓰기