startapp django

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you want to create your Django project.
  3. Run the following command to create a new Django app within your project:

bash python manage.py startapp your_app_name

  1. Open the settings.py file in your Django project folder.
  2. Locate the INSTALLED_APPS section and add the name of your newly created app to the list. It should look like this:

python INSTALLED_APPS = [ # ... 'your_app_name', # ... ]

  1. Create models in the models.py file within your app directory.
  2. Run the following command to create initial migrations for your models:

bash python manage.py makemigrations

  1. Apply the migrations to create the database tables:

bash python manage.py migrate

  1. Create views in the views.py file within your app directory.
  2. Define URLs in the urls.py file within your app directory.
  3. Include your app's URLs in the project's urls.py file.
  4. Create templates in the templates folder within your app directory.
  5. Create static files (CSS, JavaScript, etc.) in the static folder