django make app code example

Example 1: django create app

python manage.py startapp # name of the app

Example 2: start new app in django

$ python manage.py startapp app_name

Example 3: run django app

$ python manage.py runserver

Example 4: django create app

$ python manage.py startapp polls

Example 5: simple django app

# start by installing django by typing the following command

python -m pip install Django

# you can check if it worked by typing

python3 -m django --version # for mac

python -m django --version # for windows

# when that works you can start your project by

django-admin startproject your_project_name

# then you can start your first app by

django-admin startapp your_app_name

# before you can run it, you need to add the app to the project

# go to the folder your_project_name and open settings.py and scroll down until you see this

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

# then go to the folder your_app_name and open apps.py and copy the class name

# when you did that, add the following line to installed apps

'your_app_name.apps.the_class_name_you_just_copied'


# happy coding!

Example 6: django make app

...\> django-admin startproject mysite