Thank you for considering contributing to the KUASA Django Rest Framework Backend project. This guide will help you get started with the contribution process.
To contribute effectively to the KUASA Django Rest Framework Backend project, you should meet the following requirements:
-
Version Control: You should be familiar with version control systems, particularly Git and GitHub.
-
Django and Django Rest Framework: Proficiency in Django and Django Rest Framework is essential, as this project is built using these technologies.
-
Database Management: PostgreSQL should be installed on your machine.
-
Python: Knowledge of Python, including coding standards and best practices.
-
Fork the Repository:
- Click the "Fork" button at the top right of the KUASA Django Rest Framework Backend GitHub repository.
-
Clone Your Fork:
-
Clone the forked repository to your local machine using the following command:
git clone https://github.com/your-username/kuasa-dj.git
-
-
Create a Virtual Environment:
-
Navigate to the project directory and create a virtual environment:
cd kuasa-dj pipenv install
-
-
Activate the Virtual Environment:
-
Activate the virtual environment:
pipenv shell
-
-
Install Project Dependencies:
-
Install project dependencies by running the following command:
pip install -r requirements.txt
-
-
Set Up Environment Variables:
- Create a
.env
file in the project root and add your environment variables. You can use the provided.env
as a reference. Ensure thatDEBUG=True
in the.env
file to enable debugging mode. - Copy and paste the following in your
.env
file.
DEBUG=True
- Create a
-
Database Setup:
- PostgreSQL should be installed on your machine. You don't need to change anything in
settings.py
becauseDEBUG=True
is activated in the.env
file.
- PostgreSQL should be installed on your machine. You don't need to change anything in
-
Apply Migrations:
-
Apply database migrations:
python3 manage.py makemigrations python3 manage.py migrate
-
-
Populate the Database with Dummy Data:
-
To have the same dummy data as the project's development environment, you can run the following command:
python3 manage.py loaddata datadump.json
-
Note: For all dummy data users in the
datadump.json
file, their password is set to "12345678", and superuser usernames are as follows:Username Password K-1000 12345678 K-1234 12345678
-
-
Run the Development Server:
-
Start the Django development server:
python3 manage.py runserver
-
-
Create a Branch:
-
Create a new branch for your contribution:
git checkout -b feature/your-feature-name
-
-
Make Changes:
- Make your desired changes or additions to the codebase.
-
Linting and Formatting:
-
Before committing your changes, run linting with Flake8 to ensure code quality:
flake8 .
-
To fix linting errors automatically, you can use autopep8. Run the following command for each file with linting errors (replace
<filename>
with the file name):autopep8 --in-place --aggressive --aggressive <filename>
-
Some errors may need manual correction if autopep8 does not handle them.
-
-
Commit Your Changes:
-
Commit your changes with a clear and descriptive commit message:
git commit -m "Add feature: your feature description"
-
-
Push to Your Fork:
-
Push your changes to your GitHub fork:
git push origin feature/your-feature-name
-
-
Open a Pull Request:
- Go to the KUASA Django Rest Framework Backend GitHub repository and click the "New Pull Request" button.
- Select the base branch (usually "main" or "master") and your feature branch.
- Write a detailed description of your changes in the pull request.
-
Review and Collaborate:
- Participate in the discussion and address any feedback or questions related to your pull request.
-
Merge:
- Once your pull request is approved, it will be merged into the main project.
If you have any questions, feedback, or need assistance, feel free to open an issue in the GitHub repository or reach out to the project maintainers through our official communication channels.
Thank you for considering contributing to the KUASA Django Rest Framework Backend project. Your contributions are greatly appreciated, and together, we can make our backend a robust and valuable part of our website.