Answers for "write a django app"

16

create new django app

python manage.py startapp app_name
Posted by: Guest on May-16-2020
0

django create app

$ python manage.py startapp polls
Posted by: Guest on November-06-2020
0

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!
Posted by: Guest on March-23-2021

Python Answers by Framework

Browse Popular Code Answers by Language