Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 14 Apr 2019 23:22:40 UTC
Commit: 31854493a4a563270224b5d4aaf44fc69f1e5f49
https://github.com/geany/www.geany.org/commit/31854493a4a563270224b5d4aaf44…
Log Message:
-----------
Remove django-hosts
The apps Pastebin and Nightly Builds were previously hosted on
seperate subdomains but are now mounted on a sub path on the
main site for simplicity.
Modified Paths:
--------------
geany/hosts.py
geany/settings.py
geany/sitemaps.py
requirements.txt
Modified: geany/hosts.py
52 lines changed, 0 insertions(+), 52 deletions(-)
===================================================================
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-# LICENCE: This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from django_hosts import host, patterns
-from django_hosts.callbacks import cached_host_site
-
-
-# ----------------------------------------------------------------------
-def cached_host_site_extended(request, *args, **kwargs):
- # call the original django-hosts callback to do the work
- cached_host_site(request, *args, **kwargs)
- # now if it found a site, append its site.id to the request for Mezzanine
- if hasattr(request, 'site'):
- # TODO talk to Stephen about this
- request.site_id = request.site.id
-
-
-host_patterns = patterns(
- '',
- # nightlybuilds (nightly.geany.org and nightly.local.geany.org)
- host(
- r'^nightly(\.local|\.dev)?\.geany\.org(:[0-9]*)?$', 'nightlybuilds.urls',
- name='nightly.geany.org',
- callback=cached_host_site_extended),
- host(
- r'^geany\.nightlybuilds\.org(:[0-9]*)?$', 'nightlybuilds.urls',
- name='geany.nightlybuilds.org',
- callback=cached_host_site_extended),
-
- # pastebin (pastebin.geany.org and pastebin.local.geany.org)
- host(
- r'^pastebin(\.local|\.dev)?\.geany\.org(:[0-9]*)?$', 'pastebin.urls',
- name='pastebin.geany.org',
- callback=cached_host_site_extended),
-
- # default
- host(
- r'^www\.geany\.org(:[0-9]*)?$', 'geany.urls',
- name='www.geany.org',
- callback=cached_host_site_extended),
-)
Modified: geany/settings.py
7 lines changed, 0 insertions(+), 7 deletions(-)
===================================================================
@@ -322,7 +322,6 @@
# 3rd party
"honeypot", # for pastebin
- "django_hosts",
"gunicorn",
"mezzanine_pagedown",
)
@@ -334,7 +333,6 @@
"mezzanine.core.middleware.UpdateCacheMiddleware",
"django.middleware.security.SecurityMiddleware",
- "django_hosts.middleware.HostsRequestMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
# Uncomment if using internationalisation or localisation
# "django.middleware.locale.LocaleMiddleware",
@@ -352,7 +350,6 @@
# Uncomment the following if using any of the SSL settings:
# "mezzanine.core.middleware.SSLRedirectMiddleware",
"mezzanine.pages.middleware.PageMiddleware",
- "django_hosts.middleware.HostsResponseMiddleware",
"mezzanine.core.middleware.FetchFromCacheMiddleware",
)
@@ -437,10 +434,6 @@
# django compressor
COMPRESS_CSS_FILTERS = ['compressor.filters.cssmin.CSSMinFilter']
-# django-hosts
-ROOT_HOSTCONF = 'geany.hosts'
-DEFAULT_HOST = 'www.geany.org'
-
# django-honeypot
HONEYPOT_FIELD_NAME = 'website'
Modified: geany/sitemaps.py
9 lines changed, 3 insertions(+), 6 deletions(-)
===================================================================
@@ -15,7 +15,6 @@
from django.contrib import sitemaps
from django.contrib.sites.models import Site
from django.urls import NoReverseMatch, reverse
-from django_hosts.resolvers import get_host
from mezzanine.conf import settings
from mezzanine.core.sitemaps import DisplayableSitemap
@@ -99,9 +98,8 @@ def __init__(self, domain, patterns):
self._domain = domain
self._patterns = patterns
self._site = None
- self._host = None
self._url_mapping = {}
- self._get_site_and_host()
+ self._get_site()
# ----------------------------------------------------------------------
def items(self):
@@ -121,14 +119,13 @@ def _initialize(self):
self._url_mapping[pattern.name] = url_resolved
# ----------------------------------------------------------------------
- def _get_site_and_host(self):
+ def _get_site(self):
self._site = Site.objects.get(domain=self._domain)
- self._host = get_host(self._domain)
# ----------------------------------------------------------------------
def _resolve_url(self, url):
try:
- return reverse(url, urlconf=self._host.urlconf)
+ return reverse(url)
except NoReverseMatch:
return None
Modified: requirements.txt
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -4,7 +4,6 @@ mysqlclient
django-compressor
django-extensions
django-honeypot
-django-hosts
django-memcache-status
gunicorn
mezzanine-pagedown
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger(a)uvena.de>
Committer: Enrico Tröger <enrico.troeger(a)uvena.de>
Date: Sun, 14 Apr 2019 22:41:39 UTC
Commit: 8828d6f164e2ad18c63280f8b7a2525eac1c0896
https://github.com/geany/www.geany.org/commit/8828d6f164e2ad18c63280f8b7a25…
Log Message:
-----------
Cleanup sitemaps and properly add Pastebin app
Modified Paths:
--------------
geany/urls.py
nightlybuilds/urls.py
pastebin/urls.py
Modified: geany/urls.py
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -52,7 +52,7 @@
url(r"^", include("static_docs.urls")),
# nightly builds
- url(r"^download/nightly-builds/$", NightlyBuildsView.as_view()),
+ url(r"^download/nightly-builds/$", NightlyBuildsView.as_view(), name='nightlybuilds'),
# /service/version.php (for the UpdateChecker plugin)
url(r"^", include("latest_version.urls")),
Modified: nightlybuilds/urls.py
33 lines changed, 0 insertions(+), 33 deletions(-)
===================================================================
@@ -1,33 +0,0 @@
-# coding: utf-8
-# LICENCE: This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from django.conf.urls import url
-
-from geany.sitemaps import StaticSitemap
-from nightlybuilds.views import NightlyBuildsView
-
-
-urlpatterns = [
- # no admin on this site
- url(r'^admin/', 'mezzanine.core.views.page_not_found'),
-
- url(r'^$', NightlyBuildsView.as_view(), name='home'),
-]
-
-# Sitemap framework
-sitemaps = {"sitemaps": {"all": StaticSitemap('nightly.geany.org', urlpatterns)}}
-urlpatterns += (
- # use our custom sitemap implementation
- url(r"^sitemap\.xml$", 'django.contrib.sitemaps.views.sitemap', sitemaps),
-)
Modified: pastebin/urls.py
8 lines changed, 2 insertions(+), 6 deletions(-)
===================================================================
@@ -16,7 +16,7 @@
from django.views.decorators.cache import never_cache
from django.views.generic.base import TemplateView
-from geany.sitemaps import StaticSitemap
+from geany.sitemaps import sitemap_registry, StaticSitemap
from pastebin.views import (
LatestSnippetsView,
SnippetAPIView,
@@ -42,8 +42,4 @@
# Sitemap framework
-#sitemaps = {"sitemaps": {"all": StaticSitemap(settings.SITE_DOMAIN_PASTEBIN, urlpatterns)}}
-#urlpatterns += (
-# # use our custom sitemap implementation
-# url(r"^sitemap\.xml$", 'django.contrib.sitemaps.views.sitemap', sitemaps),
-#)
+sitemap_registry.add(StaticSitemap, urlpatterns)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).