enr*_*334 1 django django-rest-framework
我正在尝试设置Django Rest Framework身份验证令牌,据我了解,该表authtoken_token应在makemigrations和之后创建migrate。我将rest_framework添加到settings.py:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Site',
'rest_framework',
'rest_framework.authtoken',
'MySQLdb'
]
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAdminUser'
],
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
}
Run Code Online (Sandbox Code Playgroud)
迁移命令输出:
'manage.py@MySite > makemigrations Site
"C:\Program Files (x86)\JetBrains\PyCharm 2016.2\bin\runnerw.exe" C:\Python27\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 2016.2\helpers\pycharm\django_manage.py" makemigrations Site "C:/Users/Eric Franzen/PycharmProjects/MySite"
No changes detected in app 'Site'
Process finished with exit code 0
manage.py@MySite > migrate Site
"C:\Program Files (x86)\JetBrains\PyCharm 2016.2\bin\runnerw.exe" C:\Python27\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 2016.2\helpers\pycharm\django_manage.py" migrate Site "C:/Users/Eric Franzen/PycharmProjects/MySite"
Operations to perform:
Apply all migrations: Site
Running migrations:
No migrations to apply.
Run Code Online (Sandbox Code Playgroud)
以退出代码0'完成的过程如果有人对为什么不创建表有所了解,将不胜感激!
| 归档时间: |
|
| 查看次数: |
1538 次 |
| 最近记录: |