(pyenv) [test@SAKURA_VPS pyenv]$ django-admin startproject site01 ← 「site01」というプロジェクトを作成します。
(pyenv) [test@SAKURA_VPS pyenv]$ ls
bin include lib lib64 pip-selfcheck.json pyvenv.cfg site01 ← site01 というディレクトリが作成されています。
(pyenv) [test@SAKURA_VPS pyenv]$ cd site01/
(pyenv) [test@SAKURA_VPS site01]$ ls manage.py site01
(pyenv) [test@SAKURA_VPS site01]$ python manage.py runserver ← Django サーバーを起動します。
Performing system checks…
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run ‘python manage.py migrate’ to apply them.
November 03, 2017 – 02:48:49
Django version 1.11.7, using settings ‘site01.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[03/Nov/2017 02:49:52] “GET / HTTP/1.1” 200 1716
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r’^$’, views.home, name=’home’) Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r’^$’, Home.as_view(), name=’home’) Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r’^blog/’, include(‘blog.urls’)) “”” from django.conf.urls import include,url
from django.contrib import admin
(pyenv) [test@SAKURA_VPS site01]$ python manage.py runserver
Performing system checks…
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.
November 03, 2017 – 03:21:35
Django version 1.11.7, using settings ‘site01.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r’^$’, views.home, name=’home’)
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r’^$’, Home.as_view(), name=’home’)
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r’^blog/’, include(‘blog.urls’))
“””
from django.conf.urls import include,url
from django.contrib import admin
(pyenv) [test@SAKURA_VPS site01]$ vi urls.py
“””site01 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r’^$’, views.home, name=’home’)
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r’^$’, Home.as_view(), name=’home’)
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r’^blog/’, include(‘blog.urls’))
“””
from django.conf.urls import include,url
from django.contrib import admin
(pyenv) [test@SAKURA_VPS site01]$ cd ..
(pyenv) [test@SAKURA_VPS site01]$ ls
db.sqlite3 helloworld manage.py site01
(pyenv) [test@SAKURA_VPS site01]$ python manage.py runserver
Performing system checks…
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run ‘python manage.py migrate’ to apply them.
November 03, 2017 – 05:11:47
Django version 1.11.7, using settings ‘site01.settings’
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
コメント