django admin startproject code example

Example 1: start django

pip install django # Install Django Packages
django-admin startproject project_name # Create a Project
cd project_name
python manage.py makemigrations # Create new migrations
python manage.py migrate # Apply Migrations
python manage.py createsuperuser # Create User for admin
python manage.py runserver # Start Server

python manage.py startapp sub_module # Create a sub app

Example 2: starting server in django

# to start a django server cd to dir with manage.py file and type following
python manage.py runserver

Example 3: django create app

python manage.py startapp # name of the app

Example 4: django create app command

python manage.py startapp app_name

Example 5: python django shell command

$ python manage.py shell
...
>>> execfile('myscript.py')

Example 6: django-admin startproject

django-admin startproject name [directory]