https://pan.baidu.com/s/1bL5ml4
python.exe manage.py startapp app01
python.exe manage.py startapp app02
'DIRS': [os.path.join(BASE_DIR, 'templates')],
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static'),)
from django.conf.urls import include
urlpatterns = [
url(r'^cmdb/', include("app01.urls")),
url(r'^monitor/', include("app02.urls")),
]
在app01和app02里分别新建
urls
from django.conf.urls import url
from app01 import views
urlpatterns = [
url(r'^login/',views.login),
]
在app01views和app02views里分别写入
from django.shortcuts import render
# Create your views here.
def login(request):
pass
from django.db import models
# Create your models here.
class UserInfo(models.Model):
#app01_userinfo
#id列自增,主健
#用户名列,字符串类型,指定长度
#python manage.py makemigrations
#python manage.py migrate
username = models.CharField(max_length=32)
password = models.CharField(max_length=64)
执行
python manage.py makemigrations
python manage.py migrate