API for Python Discord Forms that handles Discord OAuth2 integration and form submission.
To start working on forms-backend, you'll need few things:
- Discord OAuth2 Application (from the Discord Developers Portal)
- Poetry
- Docker and docker-compose (optional)
- Running MongoDB instance (when not using Docker)
The easiest way to run forms-backend is using Docker (and docker-compose).
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.
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/
You can also run forms-backend manually on the host.
Create a .env file with the same contents as the Docker section above and the following new variables:
FRONTEND_URL: Forms frontend URL.DATABASE_URL: MongoDB instance URI, in formatmongodb://(username):(password)@(database IP or domain):(port).MONGO_DB: MongoDB database name, defaults topydis_forms.
Simply run: $ uvicorn --reload --host 0.0.0.0 --debug backend:app.
Once this is running the API is accessible via http://localhost:8000/ and will reload on any changes to code.