Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
itsrcx authored Sep 5, 2024
1 parent 1c0e7e7 commit c51797f
Showing 1 changed file with 55 additions and 9 deletions.
64 changes: 55 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,71 @@
# learnDjango
```md
# learnDjango 🌐

1) add your .cnf file for adding <b>mysql</b> as <b>database</b>
2) cnf file format :
![Python](https://img.shields.io/badge/Python-3.8+-blue?style=for-the-badge)
![Django](https://img.shields.io/badge/Django-4.x-green?style=for-the-badge)
![MySQL](https://img.shields.io/badge/Database-MySQL-blue?style=for-the-badge)
![Security](https://img.shields.io/badge/Security-CNF%20File-important?style=for-the-badge)

<code>[client]
---

## 🛠️ **Project Setup**

This guide will walk you through configuring MySQL as your database using a secure `.cnf` file for sensitive credentials.

### **Step 1: Add MySQL Configuration File**

- Create a `.cnf` file that contains the necessary database connection information.

#### **Sample `my.cnf` File Format**:

```ini
[client]
database = DB_NAME
host = localhost
user = DB_USER
password = DB_PASSWORD
default-character-set = utf8</code>
default-character-set = utf8
```

> ⚠️ **Note:** Never hardcode personal or sensitive information in your project's codebase. Use the `.cnf` file to protect your credentials.
---

3) <b>update</b> the <b>settings.py</b> with <b>path</b> to .cnf file:
### **Step 2: Update `settings.py` to Include `.cnf` File**

<code>DATABASES = {
In your Django project's `settings.py`, update the `DATABASES` configuration to use the `.cnf` file for database credentials:

```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
'read_default_file': '/path/to/my.cnf',
},
}
}</code>
}
```

- Replace `/path/to/my.cnf` with the actual file path to your `.cnf` file.

---

## 📸 **Screenshots**

<div align="center">
<img src="./project_images/1.png" alt="Setup Screenshot" width="300" />
<img src="./project_images/2.png" alt="CNF File Screenshot" width="300" />
<img src="./project_images/3.png" alt="CNF File Screenshot" width="300" />
</div>

---

## 🤝 **Contributing**

- Fork this repository
- Create a new branch: `git checkout -b feature/<branch_name>`
- Commit your changes: `git commit -m '<commit_message>'`
- Push to the branch: `git push origin feature/<branch_name>`
- Open a pull request

<h3>for security purposes we need .cnf file not to directly hardcode the personal info.</h3>
---

0 comments on commit c51797f

Please sign in to comment.