diff options
Diffstat (limited to 'pydis_site/apps/content/resources/guides')
5 files changed, 74 insertions, 38 deletions
diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md index fad54374..23d525b8 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/cloning-repository.md @@ -6,26 +6,29 @@ icon: fab fa-github  > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Cloning with PyCharm](#cloning-with-pycharm)  - [Cloning with the command line](#cloning-with-the-command-line) +- [Cloning with PyCharm](#cloning-with-pycharm)  The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories. You should have already retrieved your fork's Git URL as described in [**Creating a Fork**](../forking-repository).  --- -## Cloning with PyCharm -1. Load up PyCharm and click `Get from VCS`.<br> - -2. Enter the URL of your forked repository. -3. Change the directory if you desire and click `Clone`.<br> - - ---- -  ## Cloning with the command line +  1. Clone your forked repository using `git clone` followed by your fork's Git URL. Then, change your working directory to the repository. +  ```shell  $ git clone https://github.com/<your username>/sir-lancebot  ...  $ cd sir-lancebot  ``` + +--- + +## Cloning with PyCharm + +1. Load up PyCharm and click `Get from VCS`.<br> +    +2. Enter the URL of your forked repository. +3. Change the directory if you desire and click `Clone`.<br> +    diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md index 24dc9aa9..70d47563 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/contributing-guidelines/supplemental-information.md @@ -40,7 +40,7 @@ If the linter complains, the commit is aborted so that you can fix the linting e  That way, you never commit the problematic code in the first place!  Please refer to the project-specific documentation to see how to setup and run those tools. -In most cases, you can install pre-commit using `pipenv run precommit` or `poetry run task precommit`, and lint using `pipenv run lint` or `poetry run task lint`. +In most cases, you can install pre-commit using `poetry run task precommit`, and lint using `poetry run task lint`.  ## Type Hinting diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md index ba5b3d1b..26d6de30 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/installing-project-dependencies.md @@ -6,40 +6,36 @@ icon: fab fa-python  > **Note:** The process varies depending on your choice of code editor / IDE, so refer to one of the following guides: -- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm)  - [Installing dependencies with the command line](#installing-dependencies-with-the-command-line) +- [Installing dependencies with PyCharm](#installing-dependencies-with-pycharm)  The following will use the [Sir-Lancebot](https://github.com/python-discord/sir-lancebot/) repository as an example, but the steps are the same for all other repositories.  You should have already cloned your fork as described in [**Cloning a Repository**](../cloning-repository).  --- -## Installing dependencies with PyCharm -1. Load up your project in PyCharm. -2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). -3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). (**Note:** This is not required for the site) -4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`. - -5. If installing dependencies for the site, click `Pipenv Environment`, otherwise, click `Poetry Environment`, then click `OK`. - -6. PyCharm will automatically install the packages required into a virtual environment. - - ---- -  ## Installing dependencies with the command line +  1. Make sure you are in the root project directory. This directory will always have a file titled `README.md`.  2. Install project and development dependencies. Remember to also set up pre-commit hooks to ensure your pushed commits will never fail linting. ---- -- Site: -```shell -$ pipenv sync --dev -$ pipenv run precommit -``` +--- -- Other projects:  ```shell  $ poetry install  $ poetry run task precommit  ``` + +--- + +## Installing dependencies with PyCharm + +1. Load up your project in PyCharm. +2. Go to the Project Settings by clicking `File`, then `Settings...`. Alternatively, use the shortcut key: `Ctrl+Alt+S` (`command+comma` on Mac OS). +3. Install the [poetry plugin](https://plugins.jetbrains.com/plugin/14307-poetry). +4. Navigate to `Project Interpreter`, then click the gear icon and click `Add`.<br/> +   <br/> +5. Click `Poetry Environment`, then click `OK`.<br/> +   <br/> +6. PyCharm will automatically install the packages required into a virtual environment.<br/> +    diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md index 75d27d99..24227f24 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/site.md @@ -7,9 +7,9 @@ toc: 1  # Requirements -- [Python 3.8](https://www.python.org/downloads/) -- [Pipenv](https://github.com/pypa/pipenv#installation) -    - `pip install pipenv` +- [Python 3.9](https://www.python.org/downloads/) +- [Poetry](https://python-poetry.org/docs/#installation) +    - `pip install poetry`  - [Git](https://git-scm.com/downloads)      - [Windows](https://git-scm.com/download/win)      - [MacOS](https://git-scm.com/download/mac) or `brew install git` @@ -62,6 +62,7 @@ Run the following queries to create the user and database:  ```sql  CREATE USER pysite WITH SUPERUSER PASSWORD 'pysite';  CREATE DATABASE pysite WITH OWNER pysite; +CREATE DATABASE metricity WITH OWNER pysite;  ```  Finally, enter `/q` to exit psql. @@ -78,6 +79,9 @@ SECRET_KEY=suitable-for-development-only  STATIC_ROOT=staticfiles  ``` +The [Configuration in Detail](#configuration-in-detail) section contains +detailed information about these settings. +  #### Notes regarding `DATABASE_URL`  - If the database is hosted locally i.e. on the same machine as the webserver, then use `localhost` for the host. Windows and macOS users may need to use the [Docker host IP](../hosts-file/#windows) instead. @@ -122,10 +126,10 @@ If you're not using Docker, then use [pg_ctl](https://www.postgresql.org/docs/cu  ### Webserver -Starting the webserver is done simply through pipenv: +Starting the webserver is done simply through poetry:  ```shell -pipenv run start +poetry run task start  ```  --- @@ -142,3 +146,36 @@ Unless you are editing the Dockerfile or docker-compose.yml, you shouldn't need  Django provides an interface for administration with which you can view and edit the models among other things.  It can be found at [http://admin.pythondiscord.local:8000](http://admin.pythondiscord.local:8000). The default credentials are `admin` for the username and `admin` for the password. + +--- + +# Configuration in detail + +The website is configured through the following environment variables: + +## Essential +- **`DATABASE_URL`**: A string specifying the PostgreSQL database to connect to, +  in the form `postgresql://user:password@host/database`, such as +  `postgresql://joethedestroyer:ihavemnesia33@localhost/pysite_dev` + +- **`METRICITY_DB_URL`**: A string specifying the PostgreSQL metric database to + connect to, in the same form as `$DATABASE_URL`. + +- **`DEBUG`**: Controls Django's internal debugging setup. Enable this when +  you're developing locally. Optional, defaults to `False`. + +- **`LOG_LEVEL`**: Any valid Python `logging` module log level - one of `DEBUG`, +  `INFO`, `WARN`, `ERROR` or `CRITICAL`. When using debug mode, this defaults to +  `INFO`. When testing, defaults to `ERROR`. Otherwise, defaults to `WARN`. + +## Deployment +- **`ALLOWED_HOSTS`**: A comma-separated lists of alternative hosts to allow to +  host the website on, when `DEBUG` is not set. Optional, defaults to the +  `pythondiscord.com` family of domains. + +- **`SECRET_KEY`**: The secret key used in various parts of Django. Keep this +  secret as the name suggests! This is managed for you in debug setups. + +- **`STATIC_ROOT`**: The root in which `python manage.py collectstatic` +  collects static files. Optional, defaults to `/app/staticfiles` for the +  standard Docker deployment. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md b/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md index 2a6e7781..8b7c5584 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/help-channel-guide.md @@ -32,7 +32,7 @@ If you're not sure where to post, feel free to ask us which channel is relevant  Our general help channels move at a fast pace, and attract a far more diverse spectrum of helpers.  This is a great choice for a generic Python question, and a good choice if you need an answer as soon as possible. -It's particularly important to [ask good questions](..guides/asking-good-questions) when asking in these channels, or you risk not getting an answer and having your help channel be claimed by someone else. +It's particularly important to [ask good questions](../asking-good-questions) when asking in these channels, or you risk not getting an answer and having your help channel be claimed by someone else.  ## How To Claim a Channel  |