2016-06-24 1 views
4

이 자습서는 http://www.django-rest-framework.org/tutorial/1-serialization/이고 약간 이해가되지 않는 부분이 있습니다. 그들은 python manage.py startapp snippets을 수행하고 'snippets.apps.SnippetsConfig'INSTALLED_APPS에 추가하고 있습니다. 왜 이것이 아니라 'snippets'? 새 앱을 시작할 때 apps 패키지가 생성되지 않으며 WhateverConfig도 생성되지 않습니다.설정에 새로운 django rest framework app 추가

답변

3

아래에서 djagno1.9를 사용하는 경우 snippets을 추가하십시오. 이전 Django 버전에서는 startapp 관리 명령으로 apps.py가 생성되지 않습니다. 새로운 apps.py를 만들어야합니다. 대한

은> 장고 1.9 apps.pystartapp 명령

(env) simple: python manage.py startapp snippets 
(env) simple: find snippets 
snippets 
snippets/models.py 
snippets/tests.py 
snippets/views.py 
snippets/admin.py 
snippets/__init__.py 
snippets/apps.py # your apps.py 
snippets/migrations 
snippets/migrations/__init__.py 

(env) simple: cat snippets/apps.py 
from __future__ import unicode_literals 

from django.apps import AppConfig 


class SnippetsConfig(AppConfig): 
    name = 'snippets' 

장고 1.9로 업데이트 나머지 프레임 워크 문서를 작성합니다. Commit updated tutorial for django 1.9 on GitHub

더 읽기에 대한 apps.py in django 1.9

관련 문제