You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<ahref="https://gitduck.com/codebuddies/join?t=60ktFkh1Rqnd_AS1kR8ZGyH"target="_blank">Join CodeBuddies on GitDuck</a>
21
-
22
-
## Features
23
-
24
-
-**Auto-reload** - modify the application code in your editor of choice. As you save changes, the application should reload automatically. There should be no need to restart containers to see code changes.
25
-
<!-- TODO -->
26
-
27
-
## Reference
28
-
29
-
-[Background]
30
-
-[The API spec all the proof-of-concept]
31
-
-[Crowdsourced brainstorm of problems we want to solve]
32
-
- Will interact as the API supporting the [Codebuddies V3 Front-end]
33
-
34
-
## Getting started
35
-
36
-
We recommend you run CodeBuddies locally using Docker. We assume you have Docker installed, but if not head on over to the Docker [Getting Started] guide and install Docker for your operating system.
37
-
38
-
These instructions have been used on the following operating systems.
39
-
40
-
- Linux
41
-
- Mac OS
42
-
- Windows 10 Pro - Please note that Windows 10 Home is not supported by Docker Desktop at this time.
43
-
44
-
1. Fork this repository. This creates a copy of the repository for you to work on. For more help see this GitHub guide: [Fork a repo].
45
-
2. Clone your fork. This creates a copy on your local computer. For more help see this GitHub guide: [Cloning a repository].
**Note:**`-d` starts Docker in detatched mode. See [logs](#debugging-with-docker-logs)
64
-
65
-
### Local development environment details
66
-
67
-
This will run the following components:
68
-
69
-
- Nginx, a web server: http://localhost:8000 - view the application or make API calls
70
-
- Mailhog, a dummy mailbox: http://localhost:8025
71
-
- The Django web application
72
-
- Adminer, a DB front-end: http://localhost:8001
73
-
- A PostgreSQL database `postgres://babyyoda:mysecretpassword@localhost:5432/codebuddies`
74
-
75
-
You can access the database through the Adminer front-end or using a local PostgreSQL client
76
-
77
-

78
-
79
-
5. Create a superuser so that you can log into `http://localhost:8000/admin` by running the following in your terminal:
80
-
81
-
```bash
82
-
$ docker-compose run --rm app python ./manage.py createsuperuser
83
-
```
84
-
85
-
6. You can populate the database with some random test data for development purposes by running
86
-
87
-
```bash
88
-
$ docker-compose run --rm app python ./manage.py init_data
89
-
```
90
-
91
-
All user accounts created by this command have the password `codebuddies`.
4
+
## Overview of CodeBuddies
5
+
CodeBuddies is a remote-first community of independent code learners who enjoy sharing knowledge and helping each other learn faster via discussions and pairing. It is free and open-sourced, and supported by open source contributors and financial backers on our [Open Collective](https://opencollective.com/codebuddies).
6
+
7
+
We are building out a new platform (codebuddies version 3 - cbv3) to replace the old website at at [codebuddies.org](https://codebuddies.org).
8
+
9
+
The new version of the website will include features that will help users:
10
+
share and recommend links to resources/tutorials
11
+
find open source projects to work on
12
+
form study groups
13
+
collect learning paths and share them
14
+
find 1-hour pair programming partners for any topic much more easily
92
15
93
-
See the `init_data --help` command for more information:
94
16
95
-
```bash
96
-
$ docker-compose run --rm app python ./manage.py init_data --help
To stop the application and remove all containers, run the following:
125
-
126
-
127
-
```bash
128
-
$ docker-compose down
129
-
```
130
-
131
-
## Other Tasks
132
-
133
-
### Automated Tests
134
-
135
-
- We use [pytest](https://docs.pytest.org/en/latest/contents.html) with the [pytest-django](https://pytest-django.readthedocs.io/en/latest/) plugin for running tests.
136
-
- Please add tests for your code when contributing.
137
-
- Run the test suite using `docker-compose run --rm app pytest`
138
-
- With test coverage report `docker-compose run --rm app pytest --cov-report=term --cov=.`
139
-
140
-
### Debugging with Docker Logs
141
-
142
-
View logs from all containers.
143
-
144
-
```bash
145
-
$ docker-compose logs
146
-
```
147
-
148
-
View logs from a single container (in this case the `app` container).
149
-
150
-
```bash
151
-
$ docker-compose logs app
152
-
```
153
-
154
-
You can use the same structure to view logs for the other containers; `nginx`, `db`, `mailhog`, `adminer`, `app`.
155
-
156
-
If you would like to tail the logs in the console then you remove the detach flag, `-d`, from the `docker-compose up` command that you use to start the application.
157
-
158
-
### Django Management
159
-
160
-
The following are examples of some common Django management commands that you may need to run.
161
-
162
-
- Make Migrations: `docker-compose run --rm app python ./manage.py makemigrations`
- Run Migrations: `docker-compose run --rm app python ./manage.py migrate`
165
-
- Make sure new packages are installed: `docker-compose up -d --build`
166
-
167
-
To see the full list of management commands use `help`.
168
-
169
-
```plain
170
-
docker-compose run --rm app python ./manage.py help
171
-
```
172
-
173
-
### Postman
174
-
175
-
<details>
176
-
<summary>Importing Postman collection</summary>
177
-
<br>
178
-
Postman is a free interactive tool for verifying the APIs of your project. You can download it at postman.com/downloads.
179
-
180
-
Postman is an interactive tool for verifying the APIs of your project in an isolated environment--think of it as a a virtual playground where we can safely experiment and edit our API before we deploy it on our web app--just like virtual environments help us isolate our python dependencies.
181
-
182
-
We've created a shared Postman collection (a .json file) in the postman folder to help contributors more easily reproduce observed behaviour in our dev API.
17
+
**Note:** This project is currently _in development_
183
18
184
-
To get it set up, please follow these steps:
19
+
**Note:** The production branch of this repo is called `main`[to support the black lives matters movement]
185
20
186
-
1. Download Postman
21
+
## Code of Conduct
22
+
We expect contributors to follow our [code of conduct](https://codebuddies.org/slack).
187
23
188
-
Downloading Postman
189
-
Please make sure it is at least v7.6.0, if installed, or you are downloading the latest stable version.
190
-
Linux,
24
+
## Role of the Backend
25
+
The backend is a Django app that provides API endpoints that the frontend (a React app) consumes.
191
26
192
-
- Distro package manager:
193
-
- use the search feature to find in your package manager
194
-
- (RECOMMENDED) Flatpak
195
-
- After setting up flatpak it through flatpak using flatpak install postman and enter "yes"/"y" for all the questions it will ask. Flatpak is designed to provide the most up-to-date versions of software for most distros, so if you have the option, use Flatpak to guarantee Linux OS compatibility and to keep Postman up-to-date.
27
+
We have a technical decision log [here](https://github.com/codebuddies/backend/wiki/Decision-log), and we document technical discussions and learnings in the [discussions tab](https://github.com/codebuddies/backend/discussions).
196
28
197
-
2. Once you have Postman open, click on file -> import and import the .json file
198
-
3. Click on the settings gear icon on the far top right (next to the eye icon) and click to add a new environment.
199
-
4. Name your environment `dev` and create a variable called `api_url`. For both the "Initial Value" and "Current Value," fill in `http://localhost:8000` which is the URL of your Django dev environment when it is running.
200
-
5. Now, as long you have the Django app (http://localhost:8000) running, you should be able to make requests like POST Create User and POST Authenticate.
201
-
Click on this link to see what you should expect: https://imgur.com/hd9VB6k
29
+
## Front End
30
+
The front-end repo is built using React and is located at [github.com/codebuddies/frontend](https://github.com/codebuddies/frontend). Until a staging-api.codebuddies.org URL is live, contributors need to have this backend app running locally (localhost:8000) in order to develop on the front-end.
202
31
203
-
-`POST` Create User will create a new user in your `localhost:8000` running Django app,
204
-
- making a request to `POST Authenticate` will authenticate whether or not that user exists.
32
+
## Tech used
33
+
The backend uses Django built on top of [Cookiecutter](https://cookiecutter.readthedocs.io/en/1.7.0/) and [Django Rest Framework](https://www.django-rest-framework.org/).
205
34
206
-

35
+
We use Docker Compose to stand up local development environments, and GitHub Actions to deploy staging and production. We host on DigitalOcean and store everything in a managed PostgreSQL database.
207
36
208
-
5. Now, as long you have the Django app (http://localhost:8000) running, you should be able to make requests like `POST Create User` and `POST Authenticate` by clicking on the blue "Send" button in Postman.
<ahref="https://gitduck.com/codebuddies/join?t=60ktFkh1Rqnd_AS1kR8ZGyH"target="_blank">Join CodeBuddies on GitDuck</a>
237
69
238
-
**Note:** it is likely that cached copies of your container images will be retained by Docker on your local machine. This is done to speed things up if you require these images in future. To completely remove unused container images and networks, we recommend you follow Docker [pruning guide](https://docs.docker.com/config/pruning/).
70
+
## Features
239
71
240
-
</details>
72
+
-**Auto-reload** - modify the application code in your editor of choice. As you save changes, the application should reload automatically. There should be no need to restart containers to see code changes.
0 commit comments