diff options
author | 2021-10-06 23:20:56 +0200 | |
---|---|---|
committer | 2021-10-06 23:22:45 +0200 | |
commit | ce75197fc1d0b2086631277d29f9396908bdc86c (patch) | |
tree | 2eab9855ab1a83352a5d83050d8a1fc0524f3285 /pydis_site | |
parent | Merge branch 'main' into subdomains-to-query-paths (diff) | |
parent | Merge pull request #599 from python-discord/fix-http-links (diff) |
Merge branch 'master' into subdomains-to-query-paths
Diffstat (limited to 'pydis_site')
36 files changed, 222 insertions, 127 deletions
diff --git a/pydis_site/apps/api/admin.py b/pydis_site/apps/api/admin.py index 449e660e..2aca38a1 100644 --- a/pydis_site/apps/api/admin.py +++ b/pydis_site/apps/api/admin.py @@ -48,8 +48,8 @@ class BotSettingAdmin(admin.ModelAdmin): class DocumentationLinkAdmin(admin.ModelAdmin): """Admin formatting for the DocumentationLink model.""" - fields = ("package", "base_url", "inventory_url") - list_display = ("package", "base_url", "inventory_url") + fields = ("package", "inventory_url", "base_url") + list_display = ("package", "inventory_url", "base_url") list_editable = ("base_url", "inventory_url") search_fields = ("package",) diff --git a/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py b/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py new file mode 100644 index 00000000..d4899354 --- /dev/null +++ b/pydis_site/apps/api/migrations/0072_doc_allow_blank_base_url.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-08-30 21:09 + +from django.db import migrations, models +import pydis_site.apps.api.models.bot.documentation_link + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0071_increase_message_content_4000'), + ] + + operations = [ + migrations.AlterField( + model_name='documentationlink', + name='base_url', + field=models.URLField(blank=True, help_text='The base URL from which documentation will be available for this project. Used to generate links to various symbols within this package.', validators=[pydis_site.apps.api.models.bot.documentation_link.ends_with_slash_validator]), + ), + ] diff --git a/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py b/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py new file mode 100644 index 00000000..09ad13da --- /dev/null +++ b/pydis_site/apps/api/migrations/0073_otn_allow_GT_and_LT.py @@ -0,0 +1,19 @@ +# Generated by Django 3.0.14 on 2021-09-27 20:38 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0072_doc_allow_blank_base_url'), + ] + + operations = [ + migrations.AlterField( + model_name='offtopicchannelname', + name='name', + field=models.CharField(help_text='The actual channel name that will be used on our Discord server.', max_length=96, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(regex="^[a-z0-9\\U0001d5a0-\\U0001d5b9-ǃ?’'<>]+$")]), + ), + ] diff --git a/pydis_site/apps/api/models/bot/documentation_link.py b/pydis_site/apps/api/models/bot/documentation_link.py index 3dcc71fc..9941907c 100644 --- a/pydis_site/apps/api/models/bot/documentation_link.py +++ b/pydis_site/apps/api/models/bot/documentation_link.py @@ -30,6 +30,7 @@ class DocumentationLink(ModelReprMixin, models.Model): "The base URL from which documentation will be available for this project. " "Used to generate links to various symbols within this package." ), + blank=True, validators=(ends_with_slash_validator,) ) inventory_url = models.URLField( diff --git a/pydis_site/apps/api/models/bot/metricity.py b/pydis_site/apps/api/models/bot/metricity.py index 5daa5c66..33fb7ad7 100644 --- a/pydis_site/apps/api/models/bot/metricity.py +++ b/pydis_site/apps/api/models/bot/metricity.py @@ -10,7 +10,7 @@ EXCLUDE_CHANNELS = [ ] -class NotFound(Exception): +class NotFoundError(Exception): """Raised when an entity cannot be found.""" pass @@ -37,7 +37,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return dict(zip(columns, values)) @@ -58,7 +58,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return values[0] @@ -88,7 +88,7 @@ class Metricity: values = self.cursor.fetchone() if not values: - raise NotFound() + raise NotFoundError() return values[0] @@ -127,6 +127,6 @@ class Metricity: values = self.cursor.fetchall() if not values: - raise NotFound() + raise NotFoundError() return values diff --git a/pydis_site/apps/api/models/bot/off_topic_channel_name.py b/pydis_site/apps/api/models/bot/off_topic_channel_name.py index 403c7465..8999e560 100644 --- a/pydis_site/apps/api/models/bot/off_topic_channel_name.py +++ b/pydis_site/apps/api/models/bot/off_topic_channel_name.py @@ -11,7 +11,7 @@ class OffTopicChannelName(ModelReprMixin, models.Model): primary_key=True, max_length=96, validators=( - RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’']+$"), + RegexValidator(regex=r"^[a-z0-9\U0001d5a0-\U0001d5b9-ǃ?’'<>]+$"), ), help_text="The actual channel name that will be used on our Discord server." ) diff --git a/pydis_site/apps/api/models/utils.py b/pydis_site/apps/api/models/utils.py index 107231ba..0e220a1d 100644 --- a/pydis_site/apps/api/models/utils.py +++ b/pydis_site/apps/api/models/utils.py @@ -142,7 +142,7 @@ def validate_embed(embed: Any) -> None: ), MaxLengthValidator(limit_value=256) ), - 'description': (MaxLengthValidator(limit_value=2048),), + 'description': (MaxLengthValidator(limit_value=4096),), 'fields': ( MaxLengthValidator(limit_value=25), validate_embed_fields diff --git a/pydis_site/apps/api/tests/test_users.py b/pydis_site/apps/api/tests/test_users.py index bed6342e..77876d6f 100644 --- a/pydis_site/apps/api/tests/test_users.py +++ b/pydis_site/apps/api/tests/test_users.py @@ -5,7 +5,7 @@ from django.urls import reverse from .base import AuthenticatedAPITestCase from ..models import Role, User -from ..models.bot.metricity import NotFound +from ..models.bot.metricity import NotFoundError class UnauthedUserAPITests(AuthenticatedAPITestCase): @@ -501,7 +501,7 @@ class UserMetricityTests(AuthenticatedAPITestCase): self.metricity = patcher.start() self.addCleanup(patcher.stop) self.metricity = self.metricity.return_value.__enter__.return_value - self.metricity.user.side_effect = NotFound() - self.metricity.total_messages.side_effect = NotFound() - self.metricity.total_message_blocks.side_effect = NotFound() - self.metricity.top_channel_activity.side_effect = NotFound() + self.metricity.user.side_effect = NotFoundError() + self.metricity.total_messages.side_effect = NotFoundError() + self.metricity.total_message_blocks.side_effect = NotFoundError() + self.metricity.top_channel_activity.side_effect = NotFoundError() diff --git a/pydis_site/apps/api/tests/test_validators.py b/pydis_site/apps/api/tests/test_validators.py index 8bb7b917..551cc2aa 100644 --- a/pydis_site/apps/api/tests/test_validators.py +++ b/pydis_site/apps/api/tests/test_validators.py @@ -72,7 +72,7 @@ class TagEmbedValidatorTests(TestCase): def test_rejects_too_long_description(self): with self.assertRaises(ValidationError): validate_embed({ - 'description': 'd' * 2049 + 'description': 'd' * 4097 }) def test_allows_valid_embed(self): diff --git a/pydis_site/apps/api/urls.py b/pydis_site/apps/api/urls.py index 2e1ef0b4..b0ab545b 100644 --- a/pydis_site/apps/api/urls.py +++ b/pydis_site/apps/api/urls.py @@ -16,7 +16,7 @@ from .viewsets import ( UserViewSet ) -# http://www.django-rest-framework.org/api-guide/routers/#defaultrouter +# https://www.django-rest-framework.org/api-guide/routers/#defaultrouter bot_router = DefaultRouter(trailing_slash=False) bot_router.register( 'filter-lists', diff --git a/pydis_site/apps/api/viewsets/bot/user.py b/pydis_site/apps/api/viewsets/bot/user.py index 25722f5a..0356e193 100644 --- a/pydis_site/apps/api/viewsets/bot/user.py +++ b/pydis_site/apps/api/viewsets/bot/user.py @@ -11,7 +11,7 @@ from rest_framework.serializers import ModelSerializer from rest_framework.viewsets import ModelViewSet from pydis_site.apps.api.models.bot.infraction import Infraction -from pydis_site.apps.api.models.bot.metricity import Metricity, NotFound +from pydis_site.apps.api.models.bot.metricity import Metricity, NotFoundError from pydis_site.apps.api.models.bot.user import User from pydis_site.apps.api.serializers import UserSerializer @@ -275,7 +275,7 @@ class UserViewSet(ModelViewSet): data["voice_banned"] = voice_banned data["activity_blocks"] = metricity.total_message_blocks(user.id) return Response(data, status=status.HTTP_200_OK) - except NotFound: + except NotFoundError: return Response(dict(detail="User not found in metricity"), status=status.HTTP_404_NOT_FOUND) @@ -290,6 +290,6 @@ class UserViewSet(ModelViewSet): data["total_messages"] = metricity.total_messages(user.id) data["top_channel_activity"] = metricity.top_channel_activity(user.id) return Response(data, status=status.HTTP_200_OK) - except NotFound: + except NotFoundError: return Response(dict(detail="User not found in metricity"), status=status.HTTP_404_NOT_FOUND) diff --git a/pydis_site/apps/content/resources/frequently-asked-questions.md b/pydis_site/apps/content/resources/frequently-asked-questions.md index 212ea5f8..a9a092fe 100644 --- a/pydis_site/apps/content/resources/frequently-asked-questions.md +++ b/pydis_site/apps/content/resources/frequently-asked-questions.md @@ -89,7 +89,7 @@ It's also to ease the burden on our moderators, otherwise they would have to dow Even though Discord does support previewing of files like `.txt` and `.py`, that support is only available on Desktop, not mobile. Additionally, we prefer people to use hastebin as it encourages them to only copy over the relevant code snippets instead of their whole code; this makes helping much easier for all involved. -If you want to share code please use our hosted hastebin, [paste.pythondiscord.com](http://paste.pythondiscord.com). +If you want to share code please use our hosted hastebin, [paste.pythondiscord.com](https://paste.pythondiscord.com). #### **Q: Why is this permission not allowed in that channel?** 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 70d47563..e64e4fc6 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 @@ -90,7 +90,7 @@ Our projects currently defines logging levels as follows, from lowest to highest - **ERROR:** These events can cause a failure in a specific part of the application and require urgent attention. - **CRITICAL:** These events can cause the whole application to fail and require immediate intervention. -Any logging above the **INFO** level will trigger a [Sentry](http://sentry.io) issue and alert the Core Developer team. +Any logging above the **INFO** level will trigger a [Sentry](https://sentry.io) issue and alert the Core Developer team. ## Draft Pull Requests diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md index 068b08ae..60169c01 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot.md @@ -16,6 +16,15 @@ toc: 1 - [MacOS Installer](https://git-scm.com/download/mac) or `brew install git` - [Linux](https://git-scm.com/download/linux) +## Using Gitpod +Sir Lancebot can be edited and tested on Gitpod. Gitpod will automatically install the correct dependencies and Python version, so you can get straight to coding. +To do this, you will need a Gitpod account, which you can get [here](https://www.gitpod.io/#get-started), and a fork of Sir Lancebot. This guide covers forking the repository [here](#fork-the-project). Afterwards, either click the button on Sir Lancebot's README or go to [https://gitpod.io/#/python-discord/sir-lancebot]() and run the following commands in the terminal: +```sh +git remote rename origin upstream +git add remote origin https://github.com/{your_username}/sir-lancebot +``` +Make sure you replace `{your_username}` with your Github username. These commands will set Python Discord as the parent repository, and your branch as the fork. This means you can easily grab new changes from the parent repository. Once you set your environment variables to test your code, you are ready to begin contributing to Sir Lancebot. + ## Using Docker Sir Lancebot can be started using Docker. Using Docker is generally recommended (but not strictly required) because it abstracts away some additional set up work. diff --git a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md index 2a7ef0d6..eba737ad 100644 --- a/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md +++ b/pydis_site/apps/content/resources/guides/pydis-guides/contributing/sir-lancebot/env-var-reference.md @@ -43,7 +43,7 @@ If you will be working with an external service, you might have to set one of th | -------- | -------- | | `GITHUB_TOKEN` | Personal access token for GitHub, raises rate limits from 60 to 5000 requests per hour. | | `GIPHY_TOKEN` | Required for API access. [Docs](https://developers.giphy.com/docs/api) | -| `OMDB_API_KEY` | Required for API access. [Docs](http://www.omdbapi.com/) | +| `OMDB_API_KEY` | Required for API access. [Docs](https://www.omdbapi.com/) | | `REDDIT_CLIENT_ID` | OAuth2 client ID for authenticating with the [reddit API](https://github.com/reddit-archive/reddit/wiki/OAuth2). | | `REDDIT_SECRET` | OAuth2 secret for authenticating with the reddit API. *Leave empty if you're not using the reddit API.* | | `REDDIT_WEBHOOK` | Webhook ID for Reddit channel | diff --git a/pydis_site/apps/home/tests/mock_github_api_response.json b/pydis_site/apps/home/tests/mock_github_api_response.json index ddbffed8..3b0a7078 100644 --- a/pydis_site/apps/home/tests/mock_github_api_response.json +++ b/pydis_site/apps/home/tests/mock_github_api_response.json @@ -21,7 +21,7 @@ "forks_count": 31 }, { - "full_name": "python-discord/django-simple-bulma", + "full_name": "python-discord/king-arthur", "description": "test", "stargazers_count": 97, "language": "Python", diff --git a/pydis_site/apps/home/views/home.py b/pydis_site/apps/home/views/home.py index 0f26cef3..401c768f 100644 --- a/pydis_site/apps/home/views/home.py +++ b/pydis_site/apps/home/views/home.py @@ -9,7 +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 +from pydis_site.constants import GITHUB_TOKEN, TIMEOUT_PERIOD log = logging.getLogger(__name__) @@ -27,7 +27,7 @@ class HomeView(View): "python-discord/snekbox", "python-discord/sir-lancebot", "python-discord/metricity", - "python-discord/django-simple-bulma", + "python-discord/king-arthur", ] def __init__(self): @@ -51,9 +51,16 @@ class HomeView(View): If we're unable to get that info for any reason, return an empty dict. """ repo_dict = {} - - # Fetch the data from the GitHub API - api_data: List[dict] = requests.get(self.github_api, headers=self.headers).json() + try: + # Fetch the data from the GitHub API + api_data: List[dict] = requests.get( + self.github_api, + headers=self.headers, + timeout=TIMEOUT_PERIOD + ).json() + except requests.exceptions.Timeout: + log.error("Request to fetch GitHub repository metadata for timed out!") + return repo_dict # Process the API data into our dict for repo in api_data: diff --git a/pydis_site/apps/resources/resources/communities/panda3d.yaml b/pydis_site/apps/resources/resources/communities/panda3d.yaml index 4235793d..47797882 100644 --- a/pydis_site/apps/resources/resources/communities/panda3d.yaml +++ b/pydis_site/apps/resources/resources/communities/panda3d.yaml @@ -1,6 +1,6 @@ description: Panda3D is a Python-focused 3-D framework for rapid development of games, visualizations, and simulations, written in C++ with an emphasis on performance and flexibility. -title_image: http://www.panda3d.org/wp-content/uploads/2019/01/panda3d_logo.png +title_image: https://www.panda3d.org/wp-content/uploads/2019/01/panda3d_logo.png title_url: https://discord.gg/9XsucTT position: 9 urls: diff --git a/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml b/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml index 1f9642ad..2530c1a4 100644 --- a/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml +++ b/pydis_site/apps/resources/resources/reading/books/byte_of_python.yaml @@ -8,7 +8,7 @@ urls: url: https://python.swaroopch.com/ color: teal - icon: regular/book - url: http://www.lulu.com/shop/swaroop-c-h/a-byte-of-python/paperback/product-21142968.html + url: https://www.lulu.com/shop/swaroop-c-h/a-byte-of-python/paperback/product-21142968.html color: black - icon: branding/amazon url: https://www.amazon.com/Byte-Python-Swaroop-C-H-ebook/dp/B00FJ7S2JU/ diff --git a/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml b/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml index cc83a331..d191f02d 100644 --- a/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml +++ b/pydis_site/apps/resources/resources/reading/books/flask_web_development.yaml @@ -4,7 +4,7 @@ name: Flask Web Development position: 6 urls: - icon: regular/link - url: http://shop.oreilly.com/product/0636920031116.do + url: https://shop.oreilly.com/product/0636920031116.do color: teal - icon: branding/amazon url: https://www.amazon.com/Flask-Web-Development-Developing-Applications/dp/1449372627 diff --git a/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml b/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml index 032f8c64..c939ab9e 100644 --- a/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml +++ b/pydis_site/apps/resources/resources/reading/books/python_cookbook.yaml @@ -4,7 +4,7 @@ name: Python Cookbook position: 8 urls: - icon: regular/link - url: http://shop.oreilly.com/product/0636920027072.do + url: https://shop.oreilly.com/product/0636920027072.do color: teal - icon: branding/amazon url: https://www.amazon.com/Python-Cookbook-Third-David-Beazley/dp/1449340377 diff --git a/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml b/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml index a505715d..9d151bf9 100644 --- a/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml +++ b/pydis_site/apps/resources/resources/reading/tutorials/simple_guide_to_git.yaml @@ -1,6 +1,6 @@ description: A simple, no-nonsense guide to the basics of using Git. name: A Simple Guide to Git -title_url: http://rogerdudler.github.io/git-guide/ +title_url: https://rogerdudler.github.io/git-guide/ title_icon: branding/github title_icon_color: black position: 4 diff --git a/pydis_site/apps/resources/resources/videos/microsoft.yaml b/pydis_site/apps/resources/resources/videos/microsoft.yaml index 720ee202..3ceaa1a2 100644 --- a/pydis_site/apps/resources/resources/videos/microsoft.yaml +++ b/pydis_site/apps/resources/resources/videos/microsoft.yaml @@ -7,7 +7,7 @@ description: A trove of tutorials & guides for developers from Microsoft's Devel </ul> Microsoft's Python Development Team also runs a Discord Server for discussions of Python in the Microsoft ecosystem, including Visual Studio Code and Azure. -title_image: http://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2qVsJ?ver=3f74 +title_image: https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE2qVsJ?ver=3f74 position: 4 urls: - icon: branding/youtube diff --git a/pydis_site/constants.py b/pydis_site/constants.py index e6a63d12..e913f40f 100644 --- a/pydis_site/constants.py +++ b/pydis_site/constants.py @@ -2,3 +2,5 @@ import os GIT_SHA = os.environ.get("GIT_SHA", "development") GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN") +# How long to wait for synchronous requests before timing out +TIMEOUT_PERIOD = int(os.environ.get("TIMEOUT_PERIOD", 5)) diff --git a/pydis_site/settings.py b/pydis_site/settings.py index f7c4401d..35afea22 100644 --- a/pydis_site/settings.py +++ b/pydis_site/settings.py @@ -14,6 +14,7 @@ import os import secrets import sys from pathlib import Path +from socket import gethostbyname, gethostname import environ import sentry_sdk @@ -23,7 +24,8 @@ from pydis_site.constants import GIT_SHA env = environ.Env( DEBUG=(bool, False), - SITE_DSN=(str, "") + SITE_DSN=(str, ""), + BUILDING_DOCKER=(bool, False) ) sentry_sdk.init( @@ -52,7 +54,17 @@ elif 'CI' in os.environ: else: ALLOWED_HOSTS = env.list( 'ALLOWED_HOSTS', - default=['pythondiscord.com'], + default=[ + 'www.pythondiscord.com', + 'pythondiscord.com', + gethostname(), + gethostbyname(gethostname()), + # "That needs to be there for now, until we move back to... + # no, don't put that there, actually, yeah, put that there, + # that's fine, yeah, no no no no no no, stop it, you're being + # a problem now, I'm phoning [DAD'S NAME]" - Joe + 'pydis-api.default.svc.cluster.local', + ], ) SECRET_KEY = env('SECRET_KEY') @@ -77,10 +89,16 @@ INSTALLED_APPS = [ 'django_filters', 'django_simple_bulma', 'rest_framework', - 'rest_framework.authtoken' + 'rest_framework.authtoken', ] +if not env("BUILDING_DOCKER"): + INSTALLED_APPS.append("django_prometheus") + +# Ensure that Prometheus middlewares are first and last here. MIDDLEWARE = [ + 'django_prometheus.middleware.PrometheusBeforeMiddleware', + 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -89,7 +107,10 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + + 'django_prometheus.middleware.PrometheusAfterMiddleware' ] + ROOT_URLCONF = 'pydis_site.urls' TEMPLATES = [ @@ -170,7 +191,7 @@ else: PARENT_HOST = env('PARENT_HOST', default='pythondiscord.com') # Django REST framework -# http://www.django-rest-framework.org +# https://www.django-rest-framework.org REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework.authentication.TokenAuthentication', diff --git a/pydis_site/static/css/home/index.css b/pydis_site/static/css/home/index.css index ee6f6e4c..7ec8af74 100644 --- a/pydis_site/static/css/home/index.css +++ b/pydis_site/static/css/home/index.css @@ -215,12 +215,20 @@ h1 { } #sponsors .columns { + display: block; justify-content: center; margin: auto; max-width: 80%; } +#sponsors a { + margin: auto; + display: inline-block; +} + #sponsors img { - height: 5rem; - margin: auto 1rem; + width: auto; + height: auto; + + max-height: 5rem; } diff --git a/pydis_site/static/images/sponsors/netlify.png b/pydis_site/static/images/sponsors/netlify.png Binary files differnew file mode 100644 index 00000000..0f14f385 --- /dev/null +++ b/pydis_site/static/images/sponsors/netlify.png diff --git a/pydis_site/templates/base/navbar.html b/pydis_site/templates/base/navbar.html index d0d708ed..4b68dd6c 100644 --- a/pydis_site/templates/base/navbar.html +++ b/pydis_site/templates/base/navbar.html @@ -44,7 +44,7 @@ </a> {# Patreon #} - <a class="navbar-item" href="http://patreon.com/python_discord"> + <a class="navbar-item" href="https://patreon.com/python_discord"> <span class="icon is-size-4 is-medium"><i class="fab fa-patreon"></i></span> <span> Patreon</span> </a> diff --git a/pydis_site/templates/events/index.html b/pydis_site/templates/events/index.html index daad1c9c..158ec56b 100644 --- a/pydis_site/templates/events/index.html +++ b/pydis_site/templates/events/index.html @@ -9,58 +9,34 @@ {% block event_content %} <div class="box"> <h2 class="title is-4">Code Jams</h2> - <div class="notification is-success"> - The 2021 Summer Code Jam qualifier will open June 21st. Check out the details <a href="{% url "events:page" path="code-jams/8" %}">here</a>. - </div> - <p>Each year, we organize a Winter Code Jam and a Summer Code Jam. During these events, members of our community will work together in teams to create something amazing using a technology we picked for them. One such technology that was picked for the Winter Code Jam 2020 was Kivy, a cross-platform GUI framework.</p> - <p>To help fuel the creative process, we provide a specific theme, like <strong>Ancient Technology</strong> or <strong>This App Hates You</strong>. At the end of the Code Jam, the projects are judged by Python Discord server staff members and guest judges from the larger Python community. The judges will consider creativity, code quality, teamwork, and adherence to the theme.</p> + <p>Each year, we organize at least one code jam, one during the summer and sometimes one during the winter. During these events, members of our community will work together in teams to create something amazing using a technology we picked for them. One such technology that was picked for the Summer 2021 Code Jam was text user interfaces (TUIS), where teams could pick from a pre-approved list of frameworks.</p> + <p>To help fuel the creative process, we provide a specific theme, like <strong>Think Inside the Box</strong> or <strong>Early Internet</strong>. At the end of the Code Jam, the projects are judged by Python Discord server staff members and guest judges from the larger Python community. The judges will consider creativity, code quality, teamwork, and adherence to the theme.</p> <p>If you want to read more about Code Jams, visit our <a href="{% url "events:page" path="code-jams" %}">Code Jam info page</a> or watch this video showcasing the best projects created during the <strong>Winter Code Jam 2020: Ancient Technology</strong>:</p> <iframe width="560" height="315" src="https://www.youtube.com/embed/8fbZsGrqBzo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe> </div> <div class="box"> - <h2 class="title is-4">Game Jam</h2> + <h2 class="title is-4">PyWeek</h2> <div class="columns is-3" style="--columnGap: 0.75rem;"> <div class="column"> <p> - The Game Jam is similar to our Code Jams, but smaller in scope. Instead of having to complete a qualifier - and being teamed up with random strangers, members of our community can just sign-up individually or pair up - with whoever they like. - </p> - <p> - The participants will have ten days to create a game using the technology we've selected, and drawing - inspiration from a provided theme. After the event, a panel of judges will play all the games and select a - winner. The top 5 will featured in a special video on our <a href="https://www.youtube.com/channel/UCQsrA4xo6jvdgsJZhKaBL6w">YouTube channel</a>. - </p> - <p> - The <a class="has-text-link" href="{% url "events:page" path="game-jams/2020" %}">first edition of the Game Jam</a> ran from - <strong>April 17, 2020 to April 26, 2020</strong>. + For the past 15 years, <a href="https://pyweek.org" target="_blank" rel="noopener">PyWeek</a> has been running a bi-annual game jam for the + Python language. As of 2020, we are excited to say we are officially partnered with PyWeek to co-run these + events. </p> - </div> - <div class="column is-3"> - <img src="https://user-images.githubusercontent.com/33516116/77593036-5fb09780-6eeb-11ea-9feb-336b2e5e23de.png" style="border-radius: 10px;" alt=""> - </div> - </div> - </div> - - <div class="box"> - <h2 class="title is-4">Hacktoberfest</h2> - <div class="columns is-3" style="--columnGap: 0.75rem;"> - <div class="column"> <p> - This event revolves around the annual <a href="https://hacktoberfest.digitalocean.com/">Hacktoberfest - event</a> organized by Digital Ocean. In addition to promoting Hacktoberfest in our community and supporting - those who choose to take their first steps into the world of open source, we will also ease our members into - contributing to open source by starting a low-entry, beginner-friendly open source project where we will - guide our members through the open source process in a safe environment. + During each PyWeek event, we open a special discussion channel in which our members can discuss their + submissions, meet other participants, and talk to PyWeek staff. The PyWeek organizer, + Daniel Pope (<a href="https://twitter.com/lordmauve" target="_blank" rel="noopener">@lordmauve</a>) will be present during the entire event to answer + questions and post announcements and information in our community. </p> <p> - The exact form this event will take has not been decided yet, but we'll make sure to keep you updated in - our community announcements! + Unlike our other events, the <strong>community</strong> will select the winner from all the submissions + during PyWeek. We may release YouTube content showcasing the best submissions after the events are finished. </p> </div> <div class="column is-3"> - <img src="https://raw.githubusercontent.com/python-discord/branding/master/seasonal/halloween/hacktoberfest/2020/animated_server_icon.gif" style="border-radius: 10px;" alt=""> + <img src="https://pyweek.readthedocs.io/en/latest/_static/pyweek.svg" style="border-radius: 10px;" alt=""> </div> </div> </div> @@ -71,7 +47,7 @@ <div class="column"> <p> Each year, many of our members take part of an online coding competition called - <a href="https://adventofcode.com/">Advent of Code</a> that takes place in December. Advent of Code is an + <a href="https://adventofcode.com/" target="_blank" rel="noopener">Advent of Code</a> that takes place in December. Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like, including Python. </p> @@ -88,39 +64,37 @@ </p> </div> <div class="column is-3"> - <img src="https://raw.githubusercontent.com/python-discord/branding/master/seasonal/christmas/2019/festive_256.gif" style="border-radius: 10px;" alt=""> + <img src="https://raw.githubusercontent.com/python-discord/branding/main/events/christmas/server_icons/festive_256.gif" style="border-radius: 10px;" alt=""> </div> </div> </div> <div class="box"> - <h2 class="title is-4">PyWeek</h2> + <h2 class="title is-4">Game Jam</h2> <div class="columns is-3" style="--columnGap: 0.75rem;"> <div class="column"> <p> - For the past 15 years, <a href="https://pyweek.org">PyWeek</a> has been running a bi-annual game jam for the - Python language. As of 2020, we are excited to say we are officially partnered with PyWeek to co-run these - events. + The Game Jam is similar to our Code Jams, but smaller in scope. Instead of having to complete a qualifier + and being teamed up with random strangers, members of our community can just sign-up individually or pair up + with whoever they like. </p> <p> - During each PyWeek event, we open a special discussion channel in which our members can discuss their - submissions, meet other participants, and talk to PyWeek staff. The PyWeek organizer, - Daniel Pope (<a href="https://twitter.com/lordmauve">@lordmauve</a>) will be present during the entire event to answer - questions and post announcements and information in our community. + The participants will have ten days to create a game using the technology we've selected, and drawing + inspiration from a provided theme. After the event, a panel of judges will play all the games and select a + winner. The top 5 will featured in a special video on our <a href="https://www.youtube.com/channel/UCQsrA4xo6jvdgsJZhKaBL6w" target="_blank" rel="noopener">YouTube channel</a>. </p> <p> - Unlike our other events, the <strong>community</strong> will select the winner from all the submissions - during PyWeek. We may release YouTube content showcasing the best submissions after the events are finished. + The <a class="has-text-link" href="{% url "events:page" path="game-jams/2020" %}">first edition of the Game Jam</a> ran from + <strong>April 17, 2020 to April 26, 2020</strong>. </p> </div> <div class="column is-3"> - <img src="https://pyweek.readthedocs.io/en/latest/_static/pyweek.svg" style="border-radius: 10px;" alt=""> + <img src="https://user-images.githubusercontent.com/33516116/77593036-5fb09780-6eeb-11ea-9feb-336b2e5e23de.png" style="border-radius: 10px;" alt=""> </div> </div> </div> {% endblock %} {% block sidebar %} - {% include "events/sidebar/ongoing-event.html" %} {% include "events/sidebar/events-list.html" %} {% endblock %} diff --git a/pydis_site/templates/events/pages/code-jams/8/_index.html b/pydis_site/templates/events/pages/code-jams/8/_index.html index 55bdc95b..628a2c22 100644 --- a/pydis_site/templates/events/pages/code-jams/8/_index.html +++ b/pydis_site/templates/events/pages/code-jams/8/_index.html @@ -20,10 +20,58 @@ and walking through the program that your team has created. </p> + <h3 id="winners"><a href="#winners">Code Jam Winners</a></h3> + <p>Congratulations to our winners and the two runner ups! Check out their projects below.</p> + + <h4 class="mt-5 mb-2"><i class="fa fa-trophy"></i> Perceptive Porcupines: WTPython!?</h4> + <p class="my-1"><em>VV, Poppinawhile, ethansocal, Jeff Z, Cohan, ¯\_(ツ)_/¯</em></p> + <p class="my-1"> + What the Python (wtpython) is a simple terminal user interface that allows you to explore relevant answers on Stackoverflow without leaving your terminal or IDE. When you get an error, all you have to do is swap python for wtpython. When your code hits an error, you'll see a textual interface for exploring relevant answers allowing you to stay focused and ship faster! + </p> + <p> + <a href="https://www.youtube.com/watch?v=DV3uMdsw9KE" title="Perceptive Porcupines Demo Video" target="_blank" rel="noopener"><i class="fa fa-video"> </i> Demo video</a> + <br/> + <a href="https://github.com/what-the-python/wtpython" title="Perceptive Porcupines GitHub Repository" target="_blank" rel="noopener"><i class="fa fa-github"></i> GitHub Repository</a> + <br/> + + </p> + + <h4 class="mt-5 mb-2"><i class="fa fa-medal"></i> Lovable Lobsters: Ultimate Tic Tac Toe</h4> + <p class="my-1"><em>A5Rocks, Bast, Dacheat, mega_hirtz, CopOnTheRun, richphi</em></p> + <p class="my-1"> + Thinking inside a box, that is inside a box, that is inside yet another box. + + The terminal program created by the Lovable Lobsters allows you to play Ultimate Tic Tac Toe right form your terminal. The really impressive part though? You can play with your friends and family over your network! Their program has a server-client set-up that lets you play with your friends and family from different computers. + </p> + <p> + <a href="https://www.youtube.com/watch?v=WI9tgQeAfXw" title="Lovable Lobsters Demo Video" target="_blank" rel="noopener"><i class="fa fa-video"> </i> Demo video</a> + <br/> + <a href="https://github.com/A5rocks/code-jam-8" title="Lovable Lobsters GitHub Repository" target="_blank" rel="noopener"><i class="fa fa-github"></i> GitHub Repository</a> + <br/> + </p> + + <h4 class="mt-5 mb-2"><i class="fa fa-medal"></i> Robust Reindeer: Rubik's Cube</h4> + <p class="my-1"><em>Björn, aaronshenhao, mathsman, Dude Saber, 詭異, Keppo</em></p> + <p class="my-1"> + This submission is a Rubik's cube, rendered in a text user interface (that was a constraint) using the asciimatics package, and addressing the theme "thinking inside the box". + + Just like a real world Rubik's cube, you can move this cube around to look at it from all sides. And, of course, you can rotate the individual discs it is made up of to first scramble up the order and then to try and solve it into perfect ordering again. + </p> + <p> + <a href="https://github.com/bjoseru/pdcj8-robust-reindeer" title="Robust Reindeer GitHub Repository" target="_blank" rel="noopener"><i class="fa fa-github"></i> GitHub Repository</a> + <br/> + </p> + + <h3 id="submissions"><a href="#submissions">Submissions</a></h3> + <p> + 63 teams started out on July 9th 2021. By the end of the jam, 51 teams made project submissions. Check them all out here: + <div class="has-text-centered"><a class="button is-link" href="submissions">View Submissions</a></div> + </p> + <h3 id="important-dates"><a href="#important-dates">Important Dates</a></h3> <ul> <li>Tuesday, June 15 - Form to submit theme suggestions opens</li> - <li>Monday, June 21 - <a href="https://github.com/python-discord/cj8-qualifier">The Qualifier</a> is released</li> + <li>Monday, June 21 - <a href="https://github.com/python-discord/cj8-qualifier" target="_blank" rel="noopener">The Qualifier</a> is released</li> <li>Friday, June 25 - Voting for the theme opens</li> <li>Saturday, June 26 @ 4PM UTC- <a class="has-text-link" href="{% url "events:page" path="code-jams/8/github-bootcamp" %}">GitHub Bootcamp</a></li> <li>Wednesday, July 1 - The Qualifier closes</li> @@ -36,14 +84,14 @@ <p> The chosen technology/tech stack for this year is <strong>Text User Interfaces</strong> (TUIs). Each team must create a program with one of <a href="{% url "events:page" path="code-jams/8/frameworks" %}">the approved frameworks</a> that creates a user interface that is text based. - For more information of TUIs and what's involved with such an interface, check out <a href="https://en.wikipedia.org/wiki/Text-based_user_interface">this wikipedia article</a>. + For more information of TUIs and what's involved with such an interface, check out <a href="https://en.wikipedia.org/wiki/Text-based_user_interface" target="_blank" rel="noopener">this wikipedia article</a>. </p> - <h3 if="qualifier"><a href="#qualifier">The Qualifier</a></h3> + <h3 id="qualifier"><a href="#qualifier">The Qualifier</a></h3> <p> The qualifier is a coding challenge that you are required to complete before registering for the code jam. This is meant as a basic assessment of your skills to ensure you have enough python knowledge to effectively contribute in a team environment. </p> - <p class="has-text-centered"><a class="button is-link" href="https://github.com/python-discord/cj8-qualifier" target="_blank">View the Qualifier</a></p + <p class="has-text-centered"><a class="button is-link" href="https://github.com/python-discord/cj8-qualifier" target="_blank" rel="noopener">View the Qualifier</a></p> <p> Please note the requirements for the qualifier. <ul> @@ -52,11 +100,7 @@ <li>The Qualifier must be submitted through the Code Jam sign-up form.</li> </ul> </p> - <h3 id="submissions"><a href="#submissions">Submissions</a></h3> - <p> - 63 teams started out on July 9th 2021. By the end of the jam, 51 teams made project submissions. Check them all out here: - <div class="has-text-centered"><a class="button is-link" href="submissions">View Submissions</a></div> - </p> + <h3 id="prizes"><a href="#prizes">Prizes</a></h3> <p> Our Code Jam Sponsors have provided prizes for the winners of the code jam. @@ -71,7 +115,7 @@ <img src="{% static "images/events/DO_Logo_Vertical_Blue.png" %}" alt="Digital Ocean"> </div> <div class="media-content"> - <p class="subtitle has-link"><a href="https://www.digitalocean.com/">DigitalOcean</a></p> + <p class="subtitle has-link"><a href="https://www.digitalocean.com/" target="_blank" rel="noopener">DigitalOcean</a></p> <p class="is-italic"> Scalable compute platform with add-on storage, security, and monitoring capabilities. We make it simple to launch in the cloud and scale up as you grow—whether you’re running one virtual machine or ten thousand. @@ -90,7 +134,7 @@ <img src="{% static "images/sponsors/jetbrains.png" %}" alt="JetBrains"> </div> <div class="media-content"> - <p class="subtitle has-link"><a href="https://www.jetbrains.com/">JetBrains</a></p> + <p class="subtitle has-link"><a href="https://www.jetbrains.com/" target="_blank" rel="noopener">JetBrains</a></p> <p class="is-italic"> Whatever platform or language you work with, JetBrains has a development tool for you. We help developers work faster by automating common, repetitive tasks to enable them to stay focused on code design and the big picture. @@ -109,7 +153,7 @@ <img src="{% static "images/events/Tabnine.png" %}" alt="Tabnine"> </div> <div class="media-content"> - <p class="subtitle has-link"><a href="https://www.tabnine.com/now?utm_source=discord&utm_medium=Ins&utm_campaign=PythonDis">Tabnine</a></p> + <p class="subtitle has-link"><a href="https://www.tabnine.com/now?utm_source=discord&utm_medium=Ins&utm_campaign=PythonDis" target="_blank" rel="noopener">Tabnine</a></p> <p class="is-italic">Tabnine is an AI-powered code completion tool used by millions of devs around the world every day - Tabnine supports dozens of programming languages, in all of your favorite IDEs, saving you tons of time - so that you can type less and code more. Tabnine comes as a plugin and has a free-forever basic plan, so you can get started with it right away! diff --git a/pydis_site/templates/events/pages/code-jams/8/frameworks.html b/pydis_site/templates/events/pages/code-jams/8/frameworks.html index 34ac4f0a..1c02e38a 100644 --- a/pydis_site/templates/events/pages/code-jams/8/frameworks.html +++ b/pydis_site/templates/events/pages/code-jams/8/frameworks.html @@ -19,7 +19,7 @@ <div class="columns"> <div class="column"> <ul> - <li><a href="http://urwid.org/" target="_blank">Documentation Link</a></li> + <li><a href="https://urwid.org/" target="_blank">Documentation Link</a></li> <li><strong>Supports:</strong> Linux, Mac, other unix-like OS</li> <li>Somewhat in-depth tutorial</li> <li>Uses widgets in a fairly straight forward design</li> diff --git a/pydis_site/templates/events/pages/code-jams/_index.html b/pydis_site/templates/events/pages/code-jams/_index.html index 22a86db3..207d4b9a 100644 --- a/pydis_site/templates/events/pages/code-jams/_index.html +++ b/pydis_site/templates/events/pages/code-jams/_index.html @@ -66,7 +66,6 @@ {% endblock %} {% block sidebar %} - {% include "events/sidebar/code-jams/ongoing-code-jam.html" %} {% include "events/sidebar/code-jams/previous-code-jams.html" %} {% include "events/sidebar/code-jams/useful-information.html" %} {% endblock %} diff --git a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html index 9f9ecd1a..21b2ccb4 100644 --- a/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html +++ b/pydis_site/templates/events/sidebar/code-jams/previous-code-jams.html @@ -1,6 +1,7 @@ <div class="box"> <p class="menu-label">Previous Code Jams</p> <ul class="menu-list"> + <li><a class="has-text-link" href="{% url "events:page" path="code-jams/8" %}">Code Jam 8: Think Inside the Box</a></li> <li><a class="has-text-link" href="{% url "events:page" path="code-jams/7" %}">Code Jam 7: Early Internet</a></li> <li><a class="has-text-link" href="{% url "events:page" path="code-jams/6" %}">Code Jam 6: Ancient Technology</a></li> <li><a class="has-text-link" href="{% url "events:page" path="code-jams/5" %}">Code Jam 5: Climate Change</a></li> diff --git a/pydis_site/templates/events/sidebar/events-list.html b/pydis_site/templates/events/sidebar/events-list.html index 327b0e77..5dfe5dc2 100644 --- a/pydis_site/templates/events/sidebar/events-list.html +++ b/pydis_site/templates/events/sidebar/events-list.html @@ -1,10 +1,10 @@ <div class="box"> - <p class="menu-label">Event Calendar 2020</p> + <p class="menu-label">Event Calendar 2021</p> <ul class="menu-list"> - <li><a class="has-text-link" href="{% url "events:page" path="code-jams/6" %}">January 17-January 26: Winter Code Jam</a></li> - <li><a class="has-text-link" href="{% url "events:page" path="game-jams/2020" %}">April 17-April 26: Game Jam</a></li> - <li><a class="has-text-link" href="{% url "events:page" path="code-jams/7" %}">July 31-August 9: Summer Code Jam</a></li> - <li><a class="has-text-black" style="cursor: default;">October: Hacktoberfest</a></li> + <li><a class="has-text-link" href="https://pyweek.org/31/" target="_blank" rel="noopener">March: PyWeek 31</a></li> + <li><a class="has-text-black" style="cursor: default;">May: Pixels</a></li> + <li><a class="has-text-link" href="{% url "events:page" path="code-jams/8" %}">July: Summer Code Jam</a></li> + <li><a class="has-text-link" href="https://pyweek.org/32/" target="_blank" rel="noopener">September: PyWeek 32</a></li> <li><a class="has-text-black" style="cursor: default;">December: Advent of Code</a></li> </ul> </div> diff --git a/pydis_site/templates/home/index.html b/pydis_site/templates/home/index.html index 129320b3..985ccae1 100644 --- a/pydis_site/templates/home/index.html +++ b/pydis_site/templates/home/index.html @@ -9,21 +9,14 @@ {% block content %} {% include "base/navbar.html" %} - <!-- Mobile-only Notice --> - <section id="mobile-notice" class="message is-primary is-hidden-tablet"> - <a href="/events/code-jams/8/"> - <img src="{% static "images/events/summer_code_jam_2021/front_page_banners/currently_live.png" %}" alt="Summer Code Jam 2021"> - </a> - </section> - <!-- Wave Hero --> <section id="wave-hero" class="section is-hidden-mobile"> <div class="container"> - <div class="columns is-variable is-8"> + <div class="columns is-variable is-8 is-centered"> {# Embedded Welcome video #} - <div id="wave-hero-left" class="column is-half"> + <div id="wave-hero-left" class="column is-half "> <div class="force-aspect-container"> <iframe class="force-aspect-content" @@ -44,13 +37,6 @@ ></iframe> </div> </div> - - {# Code Jam banner #} - <div id="wave-hero-right" class="column is-half"> - <a href="/events/code-jams/8/"> - <img src="{% static "images/events/summer_code_jam_2021/front_page_banners/currently_live.png" %}" alt="Summer Code Jam 2021"> - </a> - </div> </div> </div> @@ -201,6 +187,10 @@ </a> <a href="https://streamyard.com" class="column is-narrow"> <img src="{% static "images/sponsors/streamyard.png" %}" alt="StreamYard"/> + </a> + <a href="https://www.netlify.com/" class="column is-narrow"> + <img src="{% static "images/sponsors/netlify.png" %}" alt="Netlify"/> + </a> <a href="https://www.cloudflare.com/" class="column is-narrow"> <img src="{% static "images/sponsors/cloudflare.png" %}" alt="Cloudflare"/> </a> diff --git a/pydis_site/urls.py b/pydis_site/urls.py index 3c9fe347..891dbdcc 100644 --- a/pydis_site/urls.py +++ b/pydis_site/urls.py @@ -13,6 +13,7 @@ urlpatterns = ( # This must be mounted before the `content` app to prevent Django # from wildcard matching all requests to `pages/...`. path('', include('pydis_site.apps.redirect.urls')), + path('', include('django_prometheus.urls')), path('pages/', include('pydis_site.apps.content.urls', namespace='content')), path('resources/', include('pydis_site.apps.resources.urls')), path('events/', include('pydis_site.apps.events.urls', namespace='events')), |