|
6 | 6 |
|
7 | 7 | <img width="1439" alt="image" src="https://github.com/user-attachments/assets/ef2cfaba-6934-4aa4-8383-470ed159a57c">
|
8 | 8 |
|
| 9 | + |
| 10 | +# Prerequisites |
| 11 | +Make sure you have the following software installed on your machine: |
| 12 | +- Python: Download and install the latest version from Python.org. |
| 13 | +- pip: This is the package installer for Python, typically included with Python installation. |
| 14 | +- Virtualenv: This helps create isolated Python environments. You can install it using pip if not - already installed: |
| 15 | + |
| 16 | +```bash |
| 17 | +pip install virtualenv |
| 18 | +``` |
| 19 | +# Clone the repository |
| 20 | +First, clone the repository to your local machine using Git. Open your terminal and run the following command: |
| 21 | +```bash |
| 22 | +git clone https://github.com/your-username/your-repository-name.git |
| 23 | +``` |
| 24 | +## Navigate to the project directory |
| 25 | +Change your working directory to the project's directory |
| 26 | +```bash |
| 27 | +cd backend |
| 28 | +``` |
| 29 | +## Create and Activate virtual Environment |
| 30 | +```bash |
| 31 | +virtualenv venv |
| 32 | +``` |
| 33 | +### Activate |
| 34 | +**On mac/Linux** |
| 35 | + |
| 36 | +```bash |
| 37 | +source venv/bin/activate |
| 38 | +``` |
| 39 | + |
| 40 | +**On Windows** |
| 41 | +```bash |
| 42 | +venv\Scripts\activate |
| 43 | + |
| 44 | +``` |
| 45 | +## Install Dependencies |
| 46 | +Install the project dependencies listed in the requirements.txt file: |
| 47 | +```bash |
| 48 | +pip install -r requirements.txt |
| 49 | +``` |
| 50 | +Install Django using pip within your virtual environment: |
| 51 | +```bash |
| 52 | +pip install django |
| 53 | +``` |
| 54 | +Install Django REST Framework using pip: |
| 55 | +```bash |
| 56 | +pip install djangorestframework |
| 57 | +``` |
| 58 | +## Set up the Database |
| 59 | +Run the following commands to set up the database: |
| 60 | +```bash |
| 61 | +python manage.py makemigrations |
| 62 | +python manage.py migrate |
| 63 | +``` |
| 64 | +## Create a Superuser |
| 65 | +Create a superuser to access the Django admin interface: |
| 66 | +```bash |
| 67 | +python manage.py createsuperuser |
| 68 | +``` |
| 69 | +### Run the Development Server |
| 70 | +Start the development server: |
| 71 | +```bash |
| 72 | +python manage.py runserver |
| 73 | +``` |
| 74 | +The development server will typically be available at **http://127.0.0.1:8000**. |
| 75 | + |
| 76 | +## Troubleshooting |
| 77 | +### Common Issues |
| 78 | + |
| 79 | +- If you encounter an error like pip: command not found, ensure Python and pip are properly installed. |
| 80 | +- If you see dependency errors, try deleting the venv folder and re-create the virtual environment, then re-run pip install -r requirements.txt. |
| 81 | + |
| 82 | +# Useful Links: |
| 83 | +- [Django Documentation](https://docs.djangoproject.com/en/5.0/) |
| 84 | +- [Django REST Framework Documentation](https://www.django-rest-framework.org/) |
| 85 | +- [Python Downloads](https://www.python.org/downloads/) |
| 86 | +- [pip Documentation](https://pip.pypa.io/en/stable/) |
| 87 | + |
0 commit comments