Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…programs-backend into Issue78
  • Loading branch information
decon-harsh committed Mar 7, 2021
2 parents 9c66a98 + f1d266a commit 86d4a53
Show file tree
Hide file tree
Showing 44 changed files with 11,646 additions and 117 deletions.
35 changes: 0 additions & 35 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

17 changes: 0 additions & 17 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

26 changes: 0 additions & 26 deletions .github/ISSUE_TEMPLATE/user-story.md

This file was deleted.

5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ Fixes #ISSUE
- [ ] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] Any dependent changes have been merged
- [ ] I have written Kotlin Docs whenever is applicable
- [ ] I have updated Postman API inside [docs](https://github.com/anitab-org/open-source-programs-backend/blob/develop/docs/OSP.postman_collection.json)
- [ ] I have updated dependencies in `requirements.txt`


**Code/Quality Assurance Only**
- [ ] My changes generate no new warnings
- [ ] My PR currently breaks something (fix or feature that would cause existing functionality to not work as expected)
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been published in downstream modules
- [ ] Any dependent changes have been published in downstream modules
34 changes: 34 additions & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Configuration for welcome - https://github.com/behaviorbot/welcome

# Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome
# Comment to be posted to on first time issues

newIssueWelcomeComment: >
Hello there!👋 Welcome to the project!💖
Thank you and congrats🎉for opening your very first issue in this project. AnitaB.org is an inclusive community, committed to creating a safe and positive environment.🌸 Please adhere to our [Code of Conduct](https://github.com/anitab-org/open-source-programs-backend/blob/develop/CODE_OF_CONDUCT.md).🙌
You may submit a PR if you like. If you want to report a bug🐞 please follow our [ISSUE_TEMPLATE.md](https://github.com/anitab-org/.github/tree/main/.github/ISSUE_TEMPLATE). Also make sure you include steps to reproduce it and be patient while we get back to you.😄
Feel free to join us on [AnitaB.org Open Source Zulip Community](https://anitab-org.zulipchat.com/).💖 We have different streams for each active repository for discussions.✨ Hope you have a great time there!😄
# Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome
# Comment to be posted to on PRs from first time contributors in your repository

newPRWelcomeComment: >
Hello there!👋 Welcome to the project!💖
Thank you and congrats🎉 for opening your first pull request.✨ AnitaB.org is an inclusive community, committed to creating a safe and positive environment.🌸Please adhere to our [Code of Conduct](https://github.com/anitab-org/open-source-programs-backend/blob/develop/CODE_OF_CONDUCT.md) and [Contribution Guidelines](https://github.com/anitab-org/open-source-programs-backend/blob/develop/.github/CONTRIBUTING.md).🙌.We will get back to you as soon as we can.😄
Feel free to join us on [AnitaB.org Open Source Zulip Community](https://anitab-org.zulipchat.com/).💖 We have different streams for each active repository for discussions.✨ Hope you have a great time there!😄
# Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge
# Comment to be posted to on pull requests merged by a first time user

firstPRMergeComment: >
Congrats on merging your first pull request! 🎉🎉🎉 We here at AnitaB.org are proud of you!
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage==5.4
- name: Creating Zulip API key
run: echo -e "${{ secrets.ZULIP_API_KEY }}" >> download
- name: Exporting Secret Key
run: echo -e "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env

- name: Migrating Test Database
run: python manage.py migrate
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Anyone asked to stop unacceptable behavior is expected to comply immediately.
If a community member engages in unacceptable behavior, the community admins may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event).

## 6. Reporting Guidelines
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community admin as soon as possible by emailing [email protected]. Please read [Reporting Guidelines](reporting_guidelines.md) for details.
If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community admin as soon as possible by emailing [email protected]. Please read [Reporting Guidelines](REPORTING_GUIDELINES.md) for details.



Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,16 @@ Next follow these instructions.

Follow the given instructions for Login into the app.

1. You can register a new user by setting up SendGrid details in the `settings.py`, you can take a reference from [here](https://sendgrid.com/docs/for-developers/sending-email/integrating-with-the-smtp-api/)
1. You can register a new user by making a POST request on `/api/token_auth/register/`. After this confirmation e-mail will be sent to standard output (terminal). To receive confirmation e-mail using Sendgrid see [this](#environment-variables). The content of the request must be like this:
```json
{
"username":"< YOUR USERNAME >",
"email":"< YOUR EMAIL >",
"password":"< YOUR PASSWORD >",
"confirm_password":"< YOUR PASSWORD >"
}
```


2. To create the superuser run:
```
Expand All @@ -109,7 +118,7 @@ Follow the given instructions for Login into the app.

1. `Zulip API KEY file` - You can go [Zulip](https://anitab-org.zulipchat.com) and follow [these instructions to get your API KEY](https://zulip.com/api/api-keys#get-your-api-key). Download the file and save it in the root folder of the project with the name `download`.

2. `SENDGRID_API_KEY` - Follow the given steps to create a Sendgrid API key:
2. `SENDGRID_API_KEY` - It is optional for development. To use this variable make `DEBUG=False` in `settings.py`. Follow the given steps to create a Sendgrid API key:

1. Go to [Sendgrid's website](https://app.sendgrid.com/guide)
2. Navigate to Settings on the left navigation bar, and then - select API Keys.
Expand All @@ -124,6 +133,9 @@ Add it to your .env file as follows:
export SENDGRID_API_KEY=<your-sendgrid-api-key>
```
3. `SECRET_KEY` - This environment variable is required for running the backend. Add `SECRET_KEY` in `.env` file or export it by using `export SECRET_KEY=<YOUR SECRET KEY>`.
## Testing
**Test Database:**
Expand Down Expand Up @@ -173,8 +185,8 @@ Run ``sudo docker-compose up`` from the root directory of project. Navigate to `
- To **interact** with docker containers use ``docker exec -it {container id} bash`` from your terminal. Container id can be found using ``docker ps``.

## Documentation

- Read the [Meeting minutes](https://docs.google.com/document/d/1JSyAr9bO4hJJxFvThvn_LVjW0KcEspXpzvWULRC_xJE/edit) notes from our open sessions about the project.
Documentation for the project is hosted [here](https://osp-backend-docs.surge.sh/). `Docusaurus` has been used for maintaining the documentation of the project.
- Read the [Meeting minutes](https://docs.google.com/document/d/1YF13IbBrU1ln4ZF1fOpgb-xGRgIF6tZLSjIBQgDmN7k/edit) notes from our open sessions about the project.
- For setting up the project locally watch [this video](https://youtu.be/_b2RQGbYN9w).
- To learn about the project's initial features, watch the video of [project demonstration](https://youtu.be/3A746GppZ0Y).
- [Design and Mocks Google Drive folder](https://drive.google.com/drive/folders/1MybSH3f8peXGUSRxhDydDtoAi8WJL1th).
Expand Down
27 changes: 16 additions & 11 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "7ibm!g0j@gs7kszwav!6$*lar(+!!l3tpm@09s%csl2bj)l+p4"

if os.environ.get("SECRET_KEY"):
SECRET_KEY = os.environ["SECRET_KEY"]
else:
raise ValueError("Secret Key can't be empty or None.")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

Expand Down Expand Up @@ -96,15 +98,18 @@
"http://localhost:3000",
]

SENDGRID_API_KEY = os.getenv("SENDGRID_API_KEY")
SENDGRID_SANDBOX_MODE_IN_DEBUG = False
SENDGRID_ECHO_TO_STDOUT = True
EMAIL_HOST = "smtp.sendgrid.net"
EMAIL_HOST_USER = "apikey"
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
if DEBUG:
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
else:
SENDGRID_API_KEY = os.getenv("SENDGRID_API_KEY")
SENDGRID_SANDBOX_MODE_IN_DEBUG = False
SENDGRID_ECHO_TO_STDOUT = True
EMAIL_HOST = "smtp.sendgrid.net"
EMAIL_HOST_USER = "apikey"
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"

AUTH_USER_MODEL = "token_auth.User"

Expand Down
20 changes: 20 additions & 0 deletions osp-backend-docusaurus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
66 changes: 66 additions & 0 deletions osp-backend-docusaurus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Website

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

## Installation

```
yarn install
```

## Local Development

```
yarn start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

## Build

```
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

**Note**: You can use `npm run serve` to test your build locally.

## Deployment

```
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

## Deploying to Surge

Surge is a static web hosting platform. It is used to deploy our open source programs docusaurus from the command line in a minute.

Deploy using surge with the following steps:

1. Install Surge using npm by running the following command:
```
npm install --g surge
```
2. To build the static files of the site for production in the root/osp-backend-docusaurus directory of project, run:
```
npm run build
```
**Note**: You can use `npm run serve` to test your build locally.

3. Run this command inside the root/osp-backend-docusaurus directory of project:
```
surge build/
```
or

Deploy the site to existing domain using the command:
```
surge build/ https://osp-backend-docs.surge.sh
```

First-time users of Surge would be prompted to create an account from the command line (happens only once).

Confirm that the site you want to publish is in the build directory, a randomly generated subdomain *.surge.sh subdomain is always given (which can be edited).
3 changes: 3 additions & 0 deletions osp-backend-docusaurus/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
Loading

0 comments on commit 86d4a53

Please sign in to comment.