Monday, October 2, 2017

Django - 028 - Creating an app


To start a project we use the django-admin:

~/my-django-project $ django-admin startproject mywebsite
~/my-django-project $ ls
mywebsite
~/my-django-project $ cd mywebsite/
~/my-django-project/mywebsite $ tree
.
|-- manage.py
`-- mywebsite
    |-- __init__.py
    |-- settings.py
    |-- urls.py
    `-- wsgi.py

1 directory, 5 files
~/my-django-project/mywebsite $ 

To start create a app in django we use the startapp command:

~/my-django-project/mywebsite $ python manage.py startapp mymusic
~/my-django-project/mywebsite $ tree
.
|-- db.sqlite3
|-- manage.py
|-- mymusic
|   |-- admin.py
|   |-- apps.py
|   |-- __init__.py
|   |-- migrations
|   |   `-- __init__.py
|   |-- models.py
|   |-- tests.py
|   `-- views.py
`-- mywebsite
    |-- __init__.py
    |-- __init__.pyc
    |-- settings.py
    |-- settings.pyc
    |-- urls.py
    |-- urls.pyc
    |-- wsgi.py
    `-- wsgi.pyc

3 directories, 17 files
~/my-django-project/mywebsite $ cd ..
~/my-django-project $ tree
.
`-- mywebsite
    |-- db.sqlite3
    |-- manage.py
    |-- mymusic
    |   |-- admin.py
    |   |-- apps.py
    |   |-- __init__.py
    |   |-- migrations
    |   |   `-- __init__.py
    |   |-- models.py
    |   |-- tests.py
    |   `-- views.py
    `-- mywebsite
        |-- __init__.py
        |-- __init__.pyc
        |-- settings.py
        |-- settings.pyc
        |-- urls.py
        |-- urls.pyc
        |-- wsgi.py
        `-- wsgi.pyc

4 directories, 17 files
~/my-django-project $