4

I'm going through this tutorial: http://www.django-rest-framework.org/tutorial/1-serialization/ and there's one thing I don't understand a bit. They are doing python manage.py startapp snippets and adding 'snippets.apps.SnippetsConfig' to INSTALLED_APPS. Why this and not 'snippets'? When I start a new app no apps package gets created and neither WhateverConfig.

1 Answer 1

4

If you are using below djagno1.9 just add snippets. In older django versions startapp management command will not create apps.py. you have to create new apps.py.

For > Django 1.9 apps.py creates with startapp command

(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'

The Rest-Framework Documentation Updated to Django 1.9. Commit updated tutorial for django 1.9 on GitHub

Read more about apps.py in django 1.9

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.