From 9605f6a9297f09341c65baadfd5b62776929e39c Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 18:47:01 +0200 Subject: Add general information about forms backend --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index afe235e..76e0b68 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# forms-backend -Backend for Python Discord forms +# Python Discord Forms (Backend) +API for Python Discord forms (https://forms.pythondiscord.com) that handles Discord login and forms submissions. -- cgit v1.2.3 From 9bfbc434bf10315a4679c8cc696a321901eb8aab Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:21:23 +0200 Subject: Add local setup information to README --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 76e0b68..8bc0186 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,33 @@ # Python Discord Forms (Backend) -API for Python Discord forms (https://forms.pythondiscord.com) that handles Discord login and forms submissions. +API for Python Discord forms (https://forms.pythondiscord.com) that handles Discord login and forms, submissions. + +## Setup +### Prerequisites +To start working on forms-backend, you need few things: +1. Discord Application (in [Developers Portal](https://discord.com/developers/applications)) +2. Poetry +3. Docker and docker-compose (optional) +4. Running MongoDB instance (when not using Docker) + +### Running with Docker +Easiest way to run this is using Docker (and docker-compose). + +#### Environment variables +Set following environment variables to `.env` file: +- `OAUTH2_CLIENT_ID`: Client ID of Discord Application (prerequisites point 1). +- `OAUTH2_CLIENT_SECRET`: Client Secret of Discord Application (prerequisites point 1). +- `ALLOWED_URL`: Allowed origin for CORS middleware. + +#### Running +Running is really for this way: `docker-compose up`! And this is all: You can access now API from `http://localhost:8000`. + +### Running on host +Another way to run forms-backend is manually in host. + +#### Environment variables +First all same than in Docker environment variables section, with following additions: +- `DATABASE_URL`: MongoDB instance URI, in format `mongodb://(username):(password)@(database IP or domain):(port)`. +- `MONGO_DB`: MongoDB database name, defaults to `pydis_forms`. + +#### Running +Almost same easy than for Docker: `uvicorn --reload --host 0.0.0.0 --debug "backend:app`. -- cgit v1.2.3 From b195eb19788d680a11719897856aead9e98dd332 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:42:45 +0200 Subject: Fix wording and grammar for README Co-authored-by: Joe Banks --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8bc0186..8e84fd9 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,35 @@ -# Python Discord Forms (Backend) -API for Python Discord forms (https://forms.pythondiscord.com) that handles Discord login and forms, submissions. +# Python Discord Forms API +API for [Python Discord Forms](https://forms.pythondiscord.com) that handles Discord OAuth2 integration and form submission. ## Setup ### Prerequisites -To start working on forms-backend, you need few things: -1. Discord Application (in [Developers Portal](https://discord.com/developers/applications)) +To start working on forms-backend, you'll need few things: +1. Discord OAuth2 Application (from the [Discord Developers Portal](https://discord.com/developers/applications)) 2. Poetry 3. Docker and docker-compose (optional) 4. Running MongoDB instance (when not using Docker) ### Running with Docker -Easiest way to run this is using Docker (and docker-compose). +The easiest way to run forms-backend is using Docker (and docker-compose). #### Environment variables -Set following environment variables to `.env` file: -- `OAUTH2_CLIENT_ID`: Client ID of Discord Application (prerequisites point 1). -- `OAUTH2_CLIENT_SECRET`: Client Secret of Discord Application (prerequisites point 1). +Create a `.env` file in the root with the following values inside it: +- `OAUTH2_CLIENT_ID`: Client ID of Discord OAuth2 Application (see prerequisites). +- `OAUTH2_CLIENT_SECRET`: Client Secret of Discord OAuth2 Application (see prerequisites). - `ALLOWED_URL`: Allowed origin for CORS middleware. #### Running -Running is really for this way: `docker-compose up`! And this is all: You can access now API from `http://localhost:8000`. +To start using the application, simply run `docker-compose up` in the repository root. You'll be able to access the application by visiting http://localhost:8000/ ### Running on host -Another way to run forms-backend is manually in host. +You can also run forms-backend manually on the host. #### Environment variables -First all same than in Docker environment variables section, with following additions: +Create a `.env` file with the same contents as the Docker section above and the following new variables: - `DATABASE_URL`: MongoDB instance URI, in format `mongodb://(username):(password)@(database IP or domain):(port)`. - `MONGO_DB`: MongoDB database name, defaults to `pydis_forms`. #### Running -Almost same easy than for Docker: `uvicorn --reload --host 0.0.0.0 --debug "backend:app`. +Simply run: `$ uvicorn --reload --host 0.0.0.0 --debug backend:app`. + +Once this is running the API will live-reload on any changes. -- cgit v1.2.3 From 060fb0247e19c85d37342952db8cbc610a0d9d2e Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:45:50 +0200 Subject: Detail how to set environment variables Co-authored-by: Joe Banks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e84fd9..7b0a218 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ To start working on forms-backend, you'll need few things: The easiest way to run forms-backend is using Docker (and docker-compose). #### Environment variables -Create a `.env` file in the root with the following values inside it: +Create a `.env` file in the root with the following values inside it (each variable should be a line like `VARIABLE=value`): - `OAUTH2_CLIENT_ID`: Client ID of Discord OAuth2 Application (see prerequisites). - `OAUTH2_CLIENT_SECRET`: Client Secret of Discord OAuth2 Application (see prerequisites). - `ALLOWED_URL`: Allowed origin for CORS middleware. -- cgit v1.2.3 From 063f5b9cfbcf57eaf0a49f0303d5624262087d02 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:46:18 +0200 Subject: Add "the" before "host" for running in the host header Co-authored-by: Joe Banks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b0a218..031c93b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Create a `.env` file in the root with the following values inside it (each varia #### Running To start using the application, simply run `docker-compose up` in the repository root. You'll be able to access the application by visiting http://localhost:8000/ -### Running on host +### Running on the host You can also run forms-backend manually on the host. #### Environment variables -- cgit v1.2.3 From 97cabbf3d78ee2cbcdfac157b4230ce82e704cf2 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Fri, 27 Nov 2020 19:49:04 +0200 Subject: Specify URL and port for running in the host section Co-authored-by: Joe Banks --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 031c93b..671e6d5 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ Create a `.env` file with the same contents as the Docker section above and the #### Running Simply run: `$ uvicorn --reload --host 0.0.0.0 --debug backend:app`. -Once this is running the API will live-reload on any changes. +Once this is running the API is accessible via http://localhost:8000/ and will reload on any changes to code. -- cgit v1.2.3