Django Tutorials: How Do I Create a Django App?

By: Dusty Arlia
Published on Saturday, February 8, 2014, 02:46 PM
Last Updated on Friday, July 10, 2015 at 3:10 PM
Total Updates: 6

From the same directory manage.py is in, run this command:

python manage.py startapp your_app

Running this command generates this folder of files:

your_app/
    __init__.py
    admin.py
    models.py
    tests.py
    views.py

This directory structure will hold your application. Set the INSTALLED_APPS setting in settings.py to include the string 'your_app':

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'your_app',
)

Django will now include your_app.

The next thing you will want to do is determine if you will need a database. If you do, then you will need to define your models.

Comments:

Ad:

Ad: