1.7.1 Starting a New Project
Run the startproject command:
django-admin startproject myproject
Navigate to the project directory:
cd myproject
1.7.2 Understanding the Django Project Structure
A newly created project includes:
manage.py: A command-line utility to interact with the project (e.g., runserver, migrations).- Project Directory (
myproject):__init__.py: Marks the directory as a Python package.settings.py: Configures project settings (e.g., database, static files).urls.py: Maps URLs to views.asgi.pyandwsgi.py: Configurations for serving the project.
1.7.3 Running the Development Server
Start the server:
python manage.py runserver
Open a browser and visit:
http://127.0.0.1:8000/
ou’ll see Django’s default welcome page, confirming the server is running.