testing #8
@@ -0,0 +1,7 @@
|
||||
from django.conf import settings
|
||||
from django_hosts import patterns, host
|
||||
|
||||
host_patterns = patterns('',
|
||||
host(r"django-testing", settings.ROOT_URLCONF, name="django-testing"),
|
||||
host(r"redirect", 'website_redirection.urls', name="redirect"),
|
||||
)
|
||||
@@ -9,7 +9,7 @@ https://docs.djangoproject.com/en/4.2/topics/settings/
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
@@ -23,10 +23,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
SECRET_KEY = 'django-insecure-71%)_#e#o9-dl2o^6mfud-*rw+4+8vy-nd*bzeier&(34ap-p9'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['reverse.tryton.geeraert.eu','192.168.4.100','django.tryton.geeraert.eu','localhost']
|
||||
DEBUG = os.getenv("DEBUG")
|
||||
|
||||
ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS").split(",")
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -38,9 +37,11 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'bootstrap5',
|
||||
'django_hosts',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django_hosts.middleware.HostsRequestMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
@@ -48,9 +49,13 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'django_hosts.middleware.HostsResponseMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'django_code.urls'
|
||||
ROOT_HOSTCONF = 'django_code.hosts'
|
||||
DEFAULT_HOST = 'django-testing'
|
||||
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ from stash_management import apps as stashapp
|
||||
from stash_management import views as stashview
|
||||
from website_redirection import apps as website_redirectionapp
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
<h1 id="title">Redirect Form</h1>
|
||||
<p id="description" class="description" class="text-center">Download form</p>
|
||||
</div>
|
||||
<form method="GET" action="/redirect/redirect-form/" id="survey-form" name="survey-form">
|
||||
<form method="GET" action="/redirect-form/" id="survey-form" name="survey-form">
|
||||
|
||||
<fieldset>
|
||||
<label for="key" id="key-label">
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
URL configuration for django_code project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.2/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from website_redirection import apps as website_redirectionapp
|
||||
|
||||
urlpatterns = [
|
||||
# path('admin/', admin.site.urls),
|
||||
|
||||
################### Redirect ###################
|
||||
path('', website_redirectionapp.hello),
|
||||
path('hello/', website_redirectionapp.hello),
|
||||
path('set/', website_redirectionapp.redirect),
|
||||
path('get/<str:key>', website_redirectionapp.display_key),
|
||||
path('go/<str:key>', website_redirectionapp.redirect_to_key),
|
||||
path('redirect-form/', website_redirectionapp.redirect_process, name='submit_form'),
|
||||
path('clearkey/', website_redirectionapp.clearkey_process, name='submit_form'),
|
||||
|
||||
|
||||
|
||||
]
|
||||
@@ -1,13 +1,15 @@
|
||||
# Stage 1: Build the module
|
||||
FROM python:3
|
||||
|
||||
MAINTAINER pi-ux-ce
|
||||
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
WORKDIR /code/
|
||||
|
||||
# Install build tools and MaxMind library
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git && \
|
||||
apt-get install -y git nano && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Clone the specific GeoIP2 module project
|
||||
|
||||
@@ -13,3 +13,4 @@ celery
|
||||
redis
|
||||
lxml
|
||||
requests
|
||||
django-hosts
|
||||
|
||||
Reference in New Issue
Block a user