use*_*619 15 django django-rest-framework
我试图在Windows机器上设置DJango restframework,当我运行代码时出现以下错误,
完成的步骤.
使用easy_install我安装了所有软件包.
这是确认消息,
C:\ Python27\Scripts> easy_install django-rest搜索django-rest最佳匹配:django-rest 0.0.1处理django_rest-0.0.1-py2.7.egg django-rest 0.0.1已经是easy的活动版本了-install.pth
使用c:\ python27\lib\site-packages\django_rest-0.0.1-py2.7.egg处理django-rest的依赖关系django-rest的已完成处理依赖关系
创建了一个新项目firstwebservice,它创建了所有文件.
编辑settings.py文件并包含django rest,如下所示,
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
Run Code Online (Sandbox Code Playgroud)跑完项目
Error:-No module named rest_framework...
Run Code Online (Sandbox Code Playgroud)Gly*_*son 24
是实际安装了rest_framework还是你的PYTHONPATH?
这看起来像是一个基本的导入错误.
建议你:
通过运行"manage.py shell"并尝试"import rest_framework"和"from rest_framework import authtoken",仔细检查所有内容是否正确安装.
如果可以的话,我会用pip安装不容易,之前很容易给我很多这样的问题.
sudo pip install djangorestframework
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
17121 次 |
最近记录: |