Django Tutorial
Django Create A Complete Project
Django Template
Django Database Query
Django Form
Django Authentication and Permission Management
Django unittest
Django Advanced
Starting a new Django project involves setting up the project structure, creating the necessary files, and configuring your environment. Here's a step-by-step guide on how to start a Django project:
pip install django
python -m venv myvenv
This will create a new virtual environment named myvenv
. To activate the virtual environment, run the appropriate command for your system:
myvenv\Scripts\activate
source myvenv/bin/activate
django-admin
command-line tool. In the terminal, run the following command:django-admin startproject myproject
Replace myproject
with your desired project name. This command will create a new directory named myproject
with the necessary files and folders for a Django project.
cd
command:cd myproject
python manage.py runserver
command:python manage.py runserver
By default, the server will run on port 8000. If you want to run it on a different port, provide the port number as an argument, like python manage.py runserver 8080
.
Open a web browser: Open your preferred web browser and navigate to http://127.0.0.1:8000/
(or the port you specified). You should see the Django "Welcome" page, indicating that your project is up and running.
Create a new Django app: In a Django project, you can create multiple apps, each serving a specific purpose. To create a new app, run the following command:
python manage.py startapp myapp
Replace myapp
with your desired app name. This command will create a new directory named myapp
with the necessary files and folders for a Django app.
From this point on, you can start building your Django project by creating models, views, and templates within your app(s). You can also configure settings, such as database connections and timezone, in the myproject/settings.py
file.