mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-28 15:23:33 +02:00
Add public_site_url template tag
This commit is contained in:
parent
c3f1fcba27
commit
400232a10f
7 changed files with 32 additions and 2 deletions
|
@ -20,6 +20,8 @@ applications:
|
||||||
DJANGO_BASE_URL: https://getgov-stable.app.cloud.gov
|
DJANGO_BASE_URL: https://getgov-stable.app.cloud.gov
|
||||||
# Tell Django how much stuff to log
|
# Tell Django how much stuff to log
|
||||||
DJANGO_LOG_LEVEL: INFO
|
DJANGO_LOG_LEVEL: INFO
|
||||||
|
# Public site base URL
|
||||||
|
GETGOV_PUBLIC_SITE_URL: https://federalist-877ab29f-16f6-4f12-961c-96cf064cf070.sites.pages.cloud.gov/site/cisagov/getgov-home/
|
||||||
routes:
|
routes:
|
||||||
- route: getgov-stable.app.cloud.gov
|
- route: getgov-stable.app.cloud.gov
|
||||||
services:
|
services:
|
||||||
|
|
|
@ -20,6 +20,8 @@ applications:
|
||||||
DJANGO_BASE_URL: https://getgov-ENVIRONMENT.app.cloud.gov
|
DJANGO_BASE_URL: https://getgov-ENVIRONMENT.app.cloud.gov
|
||||||
# Tell Django how much stuff to log
|
# Tell Django how much stuff to log
|
||||||
DJANGO_LOG_LEVEL: INFO
|
DJANGO_LOG_LEVEL: INFO
|
||||||
|
# default public site location
|
||||||
|
GETGOV_PUBLIC_SITE_URL: https://beta.get.gov
|
||||||
routes:
|
routes:
|
||||||
- route: getgov-ENVIRONMENT.app.cloud.gov
|
- route: getgov-ENVIRONMENT.app.cloud.gov
|
||||||
services:
|
services:
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
DJANGO_SECRET_KEY=""
|
DJANGO_SECRET_KEY=""
|
||||||
DJANGO_SECRET_LOGIN_KEY=""
|
DJANGO_SECRET_LOGIN_KEY=""
|
||||||
|
GETGOV_PUBLIC_SITE_URL="https://federalist-877ab29f-16f6-4f12-961c-96cf064cf070.sites.pages.cloud.gov/site/cisagov/getgov-home/"
|
||||||
|
|
|
@ -27,6 +27,8 @@ services:
|
||||||
- DJANGO_DEBUG=True
|
- DJANGO_DEBUG=True
|
||||||
# Tell Django where it is being hosted
|
# Tell Django where it is being hosted
|
||||||
- DJANGO_BASE_URL=http://localhost:8080
|
- DJANGO_BASE_URL=http://localhost:8080
|
||||||
|
# Public site URL link
|
||||||
|
- GETGOV_PUBLIC_SITE_URL="https://beta.get.gov"
|
||||||
# Set a username for accessing the registry
|
# Set a username for accessing the registry
|
||||||
- REGISTRY_CL_ID=nothing
|
- REGISTRY_CL_ID=nothing
|
||||||
# Set a password for accessing the registry
|
# Set a password for accessing the registry
|
||||||
|
|
|
@ -62,6 +62,9 @@ secret_registry_key = b64decode(secret("REGISTRY_KEY", ""))
|
||||||
secret_registry_key_passphrase = secret("REGISTRY_KEY_PASSPHRASE", "")
|
secret_registry_key_passphrase = secret("REGISTRY_KEY_PASSPHRASE", "")
|
||||||
secret_registry_hostname = secret("REGISTRY_HOSTNAME")
|
secret_registry_hostname = secret("REGISTRY_HOSTNAME")
|
||||||
|
|
||||||
|
# this needs to exist or a warning will be generated
|
||||||
|
secret_getgov_public_site_url = secret("GETGOV_PUBLIC_SITE_URL")
|
||||||
|
|
||||||
# region: Basic Django Config-----------------------------------------------###
|
# region: Basic Django Config-----------------------------------------------###
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / "subdir".
|
# Build paths inside the project like this: BASE_DIR / "subdir".
|
||||||
|
@ -503,6 +506,10 @@ ROOT_URLCONF = "registrar.config.urls"
|
||||||
# Must be relative and end with "/"
|
# Must be relative and end with "/"
|
||||||
STATIC_URL = "public/"
|
STATIC_URL = "public/"
|
||||||
|
|
||||||
|
# Base URL of our separate static public website. Used by the
|
||||||
|
# {% public_site_url subdir/path %} template tag
|
||||||
|
GETGOV_PUBLIC_SITE_URL = secret_getgov_public_site_url
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
# region: Registry----------------------------------------------------------###
|
# region: Registry----------------------------------------------------------###
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends 'application_form.html' %}
|
{% extends 'application_form.html' %}
|
||||||
{% load field_helpers %}
|
{% load field_helpers url_helpers %}
|
||||||
|
|
||||||
{% block form_instructions %}
|
{% block form_instructions %}
|
||||||
<p>.Gov domain names are for use on the internet. Don’t register a .gov to simply reserve a
|
<p>.Gov domain names are for use on the internet. Don’t register a .gov to simply reserve a
|
||||||
|
@ -8,7 +8,7 @@ domain name or for mainly internal use.</p>
|
||||||
<p>Describe the reason for your domain request. Explain how you plan to use this domain.
|
<p>Describe the reason for your domain request. Explain how you plan to use this domain.
|
||||||
Who is your intended audience? Will you use it for a website and/or email? Are you moving
|
Who is your intended audience? Will you use it for a website and/or email? Are you moving
|
||||||
your website from another top-level domain (like .com or .org)?
|
your website from another top-level domain (like .com or .org)?
|
||||||
Read about <a href="{% url 'todo' %}">activities that are prohibited on .gov domains.</a></p>
|
Read about <a href="{% public_site_url 'domains/requirements/' %}">activities that are prohibited on .gov domains.</a></p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,3 +19,15 @@ def startswith(text, starts):
|
||||||
if isinstance(text, str):
|
if isinstance(text, str):
|
||||||
return text.startswith(starts)
|
return text.startswith(starts)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def public_site_url(url_path):
|
||||||
|
"""Make a full URL for this path at our public site.
|
||||||
|
|
||||||
|
The public site base url is set by a GETGOV_PUBLIC_SITE_URL environment
|
||||||
|
variable.
|
||||||
|
"""
|
||||||
|
base_url = settings.GETGOV_PUBLIC_SITE_URL
|
||||||
|
public_url = urljoin(base_url, url_path)
|
||||||
|
return public_url
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue