django.com
To create a new Django project, you can follow these steps:
Step 1: Install Django using pip:
pip install django
Step 2: Create a new Django project using the following command:
django-admin startproject project_name
Step 3: Change into the project directory:
cd project_name
Step 4: Run the development server to see the basic project setup:
python manage.py runserver
Step 5: Access the Django admin interface by navigating to http://127.0.0.1:8000/admin/
in your web browser.
Step 6: Create an app within the project using the following command:
python manage.py startapp app_name
Step 7: Define models for the app by editing the models.py
file.
Step 8: Create database tables for the models by running the following command:
python manage.py makemigrations
python manage.py migrate
Step 9: Create views for the app by editing the views.py
file.
Step 10: Define URLs to map views to URLs by editing the urls.py
file.
Step 11: Run the development server again and navigate to the defined URLs to interact with the app.
These steps will help you create a basic Django project and app, define models, and set up views and URLs for your web application.