- Django - AJAX
- Django - RSS
- Django - Comments
- Django - Caching
- Django - Sessions
- Django - Cookies Handling
- Django - Apache Setup
- Django - File Uploading
- Django - Form Processing
- Django - Generic Views
- Django - Sending E-mails
- Django - Page Redirection
- Django - Models
- Django - Template System
- Django - URL Mapping
- Django - Creating Views
- Django - Admin Interface
- Django - Apps Life Cycle
- Django - Creating a Project
- Django - Environment
- Django - Overview
- Django - Basics
- Django - Home
Django Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Django - Apps Life Cycle
A project is a sum of many apppcations. Every apppcation has an objective and can be reused into another project, pke the contact form on a website can be an apppcation, and can be reused for others. See it as a module of your project.
Create an Apppcation
We assume you are in your project folder. In our main “myproject” folder, the same folder then manage.py −
$ python manage.py startapp myapp
You just created myapp apppcation and pke project, Django create a “myapp” folder with the apppcation structure −
myapp/ __init__.py admin.py models.py tests.py views.py
__init__.py − Just to make sure python handles this folder as a package.
admin.py − This file helps you make the app modifiable in the admin interface.
models.py − This is where all the apppcation models are stored.
tests.py − This is where your unit tests are.
views.py − This is where your apppcation views are.
Get the Project to Know About Your Apppcation
At this stage we have our "myapp" apppcation, now we need to register it with our Django project "myproject". To do so, update INSTALLED_APPS tuple in the settings.py file of your project (add your app name) −
INSTALLED_APPS = ( django.contrib.admin , django.contrib.auth , django.contrib.contenttypes , django.contrib.sessions , django.contrib.messages , django.contrib.staticfiles , myapp , )Advertisements