django-admin startproject myproject

  • Django provides a command that allows you to create an initial project file structure. 
  • Run the following command from your shell:

        django-admin startproject myproject

        This will create a Django project with the name myproject.

        myproject/
            manage.py
            myproject/
                __init__.py
                asgi.py
                wsgi.py
                settings.py
                urls.py

manage.py: manage.py is a command-line utility used to interact with the project. It is a thin wrapper around the django-admin.py tool. You do not need to edit this file.

In above file structure myproject/ is project directory which consists of below files:

  • __init__.py: An empty file that tells Python to treat the myproject directory as a Python module.
  • asgi.py: asgi.py is the configuration to run your project as ASGI, the emerging Python standard for asynchronous web servers and applications.
  • settings.py: This indicates settings and configuration for your project and contains initial default settings. 
    • This generated settings.py file contains the project settings, including a basic configuration to use an SQLite3 database and a list named INSTALLED_APPS that contains common Django applications that are added to the project by default.
    • Click here to know Project Settings information.

  • urls.py: urls.py is the place where your URL patterns live. Each URL defined here is mapped to a view.
  • wsgi.py: This is the configuration to run your project as a Web Server Gateway Interface (WSGI) application. 

Comments

Popular posts from this blog

Internationalization (Language Setting) in Django

reverse_lazy() Method in Django

CharFilter in Django