STATIC_URL = ‘/static/‘
STATICFILES_DIRS = [
os.path.join(BASE_DIR, ‘static‘),
]
TEMPLATES = [
{
‘BACKEND‘: ‘django.template.backends.django.DjangoTemplates‘,
‘DIRS‘: [os.path.join(BASE_DIR, ‘templates‘)]
,
‘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‘,
],
},
},
]
DATABASES = {
‘default‘: {
‘ENGINE‘: ‘django.db.backends.mysql‘,
‘NAME‘: ‘mysite‘,
‘HOST‘:‘127.0.0.1‘,
‘PORT‘: 3306,
‘USER‘: ‘root‘,
‘PASSWORD‘:‘123456‘
}
}
class User(models.Model):
id = models.AutoField(primary_key=True)
user = models.CharField(max_length=32)
password = models.CharField(max_length=24)
原文:https://www.cnblogs.com/hoffman-of-programe/p/15187606.html