-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNew Project Setup (1).txt
55 lines (42 loc) · 1.62 KB
/
New Project Setup (1).txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Django New Project Setup Guide
1. Create Virtual Environment:
- Command: `py -m venv .venv`
- Purpose: Isolates project dependencies.
2. Activate the Environment:
- Command (PowerShell): `.\.venv\Scripts\Activate.ps1`
- Purpose: Activates the virtual environment for use.
3. Install Django:
- Command: `pip install django`
- Purpose: Installs the Django
4. Install Django REST Framework (Optional):
- Command: `pip install djangorestframework`
- Purpose: Installs Django REST Framework for building APIs.
5. Create Django Project:
- Command: `django-admin startproject event-management .`
- Purpose: Initializes a new Django project named `myproject`.
6. Save Dependencies:
- Command: `pip freeze > requirements.txt`
- Purpose: Records installed dependencies for easy replication.
7. Configure PostgreSQL Database:
- File: `.env`
- Content:
```
DB_NAME=your_database_name
DB_USER=your_username
DB_PASSWORD=your_password
DB_HOST=localhost
DB_PORT=5432
```
- Purpose: Sets up database configuration for PostgreSQL.
8. Migrate Database:
- Command: `py manage.py migrate`
- Purpose: Applies migrations to create database schema.
9. Create Superuser (Optional):
- Command: `py manage.py createsuperuser`
- Purpose: Creates an admin superuser for Django admin access.
10. Start Development Server:
- Command: `py manage.py runserver`
- Purpose: Launches the local development server.
11. Delete Project:
- Command: rm -r projectfoldername
- Purpose: Delete a django project projectfoldername.