diff options
Diffstat (limited to '')
7 files changed, 42 insertions, 34 deletions
| diff --git a/docs/setup.md b/docs/setup.md index d992067e..d88021cc 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -82,8 +82,8 @@ Make sure you add the following to your hosts file:  ```  When trying to access the site, you'll be using the domains above instead of the usual `localhost:8000`. -Finally, you will need to set the environment variable `DEBUG=1`. When using `pipenv`, you can -set put this into an `.env` file to have it exported automatically. It's also recommended to +Finally, you will need to set the environment variable `DEBUG=1`. If you have `python-dotenv` installed, you can put this into a + `.env` file to have it exported automatically. It's also recommended to  export `LOG_LEVEL=INFO` when using `DEBUG=1` if you don't want super verbose logs.  To run the server, run `python manage.py runserver`. If it gives you an error saying 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 653b71aa..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,34 +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). -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/> - - ---- -  ## 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. ---- +---  ```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..899fd236 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` @@ -122,10 +122,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  ```  --- diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py index e77772fb..b3767d37 100644 --- a/pydis_site/apps/home/views/home.py +++ b/pydis_site/apps/home/views/home.py @@ -9,6 +9,7 @@ from django.utils import timezone  from django.views import View  from pydis_site.apps.home.models import RepositoryMetadata +from pydis_site.constants import GITHUB_TOKEN  log = logging.getLogger(__name__) @@ -18,6 +19,7 @@ class HomeView(View):      github_api = "https://api.github.com/users/python-discord/repos?per_page=100"      repository_cache_ttl = 3600 +    headers = {"Authorization": f"token {GITHUB_TOKEN}"}      # Which of our GitHub repos should be displayed on the front page, and in which order?      repos = [ @@ -42,7 +44,7 @@ class HomeView(View):          repo_dict = {}          # Fetch the data from the GitHub API -        api_data: List[dict] = requests.get(self.github_api).json() +        api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json()          # Process the API data into our dict          for repo in api_data: diff --git a/pydis_site/constants.py b/pydis_site/constants.py index c7ab5db0..e6a63d12 100644 --- a/pydis_site/constants.py +++ b/pydis_site/constants.py @@ -1,3 +1,4 @@  import os  GIT_SHA = os.environ.get("GIT_SHA", "development") +GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") | 
