|
| 1 | +# Instructions to Run the Project |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +1. **Install Docker and Docker Compose** |
| 6 | + Ensure Docker and Docker Compose are installed if using Method 1. |
| 7 | + |
| 8 | +2. **Check Port Availability** |
| 9 | + Ensure the following ports are not being used on your system: |
| 10 | + - **3306** (MySQL) |
| 11 | + - **8000** (Django) |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Method 1: Running Locally with Docker Compose |
| 16 | + |
| 17 | +1. **Download the Code** |
| 18 | + - Download or clone the project repository. |
| 19 | + - Navigate to the code folder in the terminal: |
| 20 | + ```bash |
| 21 | + cd /path/to/project-root/code |
| 22 | + ``` |
| 23 | + |
| 24 | +2. **Pull the Docker Image** |
| 25 | + - Pull the application image from Docker Hub: |
| 26 | + ```bash |
| 27 | + docker pull xuanshengxia/my_django_app:latest |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Start the Project** |
| 31 | + - Run the following command to start the services: |
| 32 | + ```bash |
| 33 | + docker compose up -d |
| 34 | + ``` |
| 35 | + |
| 36 | +4. **Access the Application** |
| 37 | + - Open a browser and visit: |
| 38 | + ```http |
| 39 | + http://localhost:8000 |
| 40 | + ``` |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Method 2: Running in GitHub Codespaces |
| 45 | + |
| 46 | +1. **Set Up Codespaces** |
| 47 | + - Open the **Code** panel in your GitHub repository. |
| 48 | + - Select the **Codespaces** tab and click the **Add (+)** button to create a new Codespace. |
| 49 | + |
| 50 | + |
| 51 | +2. **Run the Project** |
| 52 | + - When the Codespace is active and on the main branch, run the following commands: |
| 53 | + ```bash |
| 54 | + cd code |
| 55 | + docker-compose up --build |
| 56 | + ``` |
| 57 | + |
| 58 | + |
| 59 | +3. **Access the Application** |
| 60 | + - The terminal will display a link when the application starts running. Click the link to load the application's home page. |
| 61 | +
|
| 62 | +
|
0 commit comments