python /var/www/example.com/src/example/manage.py startapp app
sudo vim /var/www/example.com/src/example/example/setting.py
INSTALLED_APPS = [
'django.contrib.admin',
'.........
'app',
]
sudo vim /var/www/example.com/src/example/example/urls.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'', include('app.urls', namespace="app")),
]
cd /var/www/example.com/src/example/app/
sudo vim urls.py
from django.conf.urls import patterns, url
from app import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
cd /var/www/example.com/src/example/app/
sudo vim views.py
from django.shortcuts import render
#from django.http import HttpResponse
def index(request):
#return HttpResponse("home")
return render(request, 'app/index.html', {})
sudo vim /var/www/example.com/src/example/app/templates/app/index.html
"hello"
cd /var/www/example.com/src/example/
sudo python manage.py createsuperuser
'Web Service > Django' 카테고리의 다른 글
django 버전 확인 (0) | 2016.03.09 |
---|---|
우분투에서 nginx + uwsgi + django 연동 (0) | 2016.03.08 |