Skip to content

Commit

Permalink
[ DOC ]: Add more django commands
Browse files Browse the repository at this point in the history
  • Loading branch information
a1eksb committed Jul 12, 2024
1 parent aaa32df commit 9a36ac3
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions docs/docs/dev_notes/django.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,47 @@ title: Django
---

# Useful Django Commands
A collection of useful django commands that are used on a daily basis.

**Creating migrations**
**Create migrations**
```bash linenums="1"
python manage.py makemigrations
```

**Applying migrations**
**Apply migrations**
```bash linenums="1"
python manage.py migrate
```

**Create superuser**
```bash linenums="1"
python manage.py createsuperuser
```

**Change user password**
```bash linenums="1"
python manage.py changepassword <username>
```

**Clear all data**
```bash linenums="1"
python manage.py flush
```

**Revert to a previous migration**
```bash linenums="1"
python manage.py migrate 0032_name_of_migration
```
This will delete `0033_name_of_migration` and move the db one step back.

**Create fixutres**
```bash linenums="1"
python manage.py dumpdata app_name
```
The output should be saved to a `.json` file.

**Load fixutres**
```bash linenums="1"
python manage.py loaddata fixture_name.json
```

0 comments on commit 9a36ac3

Please sign in to comment.