pip install django=2.0.7
https://github.com/sshwsfc/xadmin/tree/django2
django-admin startproject mysite
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
#修改项
sys.path.insert(0, os.path.join(BASE_DIR, '../extra_apps'))
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'xadmin',#修改项
'crispy_forms',#修改项
]
配置数据库
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # 数据库引擎
'NAME': 'xadminm',
'USER': 'root',
'PASSWORD': '123456',
'HOST': 'localhost',
'PORT': '3306',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES';" # 初始化数据库的命令
}
}
}
from django.urls import path
import xadmin #修改项
urlpatterns = [
path('admin/', xadmin.site.urls), #修改项
]
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
9.配置django启动项,找到run,进行editconfig
根据以上方式启动即可访问xadmin