Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #42 -- Improved makefile and docs to simplify project setup without docker #49

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,42 @@ We will then take care of the issue as soon as possible.
git clone https://github.com/<your_username>/djangoindia.org
```

### Configuring Environment Variables

Create a .env file in the project root with necessary environment variables. Refer to .env.example for the latest variables.

### Running with Makefile

1. Backend(Django)

```sh
make backend
```
2. Frontend(Next.js)

```sh
make frontend
```

### Working with RabbitMQ
Install and start RabbitMQ:

- Ubuntu:
```sh
sudo apt-get update
sudo apt-get install rabbitmq-server
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
```
- macOS:
```sh
brew install rabbitmq
brew services start rabbitmq
```
- Windows:

Follow the [official installation guide](https://www.rabbitmq.com/docs/install-windows) to install RabbitMQ and then start the service using the RabbitMQ Service Manager.

### Without Docker
#### Backend (Django)
We are in root directory right now.
Expand Down
51 changes: 39 additions & 12 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
migrations:
python3 backend/manage.py makemigrations
# Backend commands
VENV := backend/venv
PYTHON := $(VENV)/bin/python
PIP := $(VENV)/bin/pip
DevilsAutumn marked this conversation as resolved.
Show resolved Hide resolved

migrate:
python3 backend/manage.py migrate
# Load environment variables from .env file
ifneq (,$(wildcard ./.env))
include .env
export
endif

runserver:
python3 backend/manage.py runserver
create-venv:
python3 -m venv $(VENV)

install-backend:
pip3 install -r backend/requirements/local.txt
install-backend: create-venv
$(PIP) install -r backend/requirements/local.txt

superuser:
python3 backend/manage.py createsuperuser
migrations: install-backend
$(PYTHON) backend/manage.py makemigrations

collectstatic:
python backend/manage.py collectstatic --no-input
migrate: install-backend
$(PYTHON) backend/manage.py migrate

runserver: install-backend
$(PYTHON) backend/manage.py runserver

superuser: install-backend
$(PYTHON) backend/manage.py createsuperuser

collectstatic: install-backend
$(PYTHON) backend/manage.py collectstatic --no-input

# Frontend commands
install-frontend:
cd frontend && npm install

run-frontend:
cd frontend && npm run dev

backend: install-backend migrations migrate runserver

frontend: install-frontend run-frontend

.PHONY: create-venv install-backend migrations migrate runserver superuser collectstatic install-frontend run-frontend backend frontend