Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

Learn Django Create App


Step 1: Navigate to Your Django Project

If you haven't created a Django project yet, follow the steps to set up a project. If you have a project, activate the virtual environment and navigate to your project's directory.

cd my_django_project
source venv/bin/activate

On Windows, activate the virtual environment with:

venv\Scripts\activate


Step 2: Use startapp Command

Django has a built-in command to create new apps within a project. To create a new app, run:

python manage.py startapp myapp

Replace '"myapp"' with the name of your app. This command creates a new directory named "myapp" within your Django project with the following structure:


Step 3: Register the App in Project Settings

After creating the app, you need to inform Django that it exists. Open myproject/settings.py (where "myproject" is the name of your Django project) and find the INSTALLED_APPS list. Add your new app's name to this list:

INSTALLED_APPS = [
# Existing apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# Add your app here
'myapp', # Name of the app you created ]


Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java