Add basic project setup files
This commit is contained in:
parent
4c21c9bbb2
commit
433f1faeff
14 changed files with 379 additions and 1 deletions
0
project/__init__.py
Normal file
0
project/__init__.py
Normal file
16
project/asgi.py
Normal file
16
project/asgi.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
ASGI config for project project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
|
||||
|
||||
application = get_asgi_application()
|
||||
200
project/settings.py
Normal file
200
project/settings.py
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
"""
|
||||
Django settings for project project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 4.1.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/4.1/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
PROJECT_DIR = Path(__file__).resolve().parent
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = "django-insecure-8qh(ha_fw#3mc#y+rtd^se+e$-+n5%1o*d3%3p0d379q1zxypu"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
# "djangocms_admin_style",
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.sites",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"django.contrib.humanize",
|
||||
"django.contrib.gis",
|
||||
# Froide apps
|
||||
"froide_govplan.apps.FroideGovPlanConfig",
|
||||
"froide.georegion",
|
||||
"froide.publicbody",
|
||||
"froide.follow",
|
||||
"froide.organization",
|
||||
"froide.team",
|
||||
"froide.helper",
|
||||
# Third party apps
|
||||
"easy_thumbnails",
|
||||
"filer",
|
||||
"mptt",
|
||||
"sekizai",
|
||||
"cms",
|
||||
"menus",
|
||||
"treebeard",
|
||||
# "oauth2_provider",
|
||||
# "mfa",
|
||||
"taggit",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.middleware.locale.LocaleMiddleware", # needs to be before CommonMiddleware
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"cms.middleware.user.CurrentUserMiddleware",
|
||||
"cms.middleware.page.CurrentPageMiddleware",
|
||||
"cms.middleware.toolbar.ToolbarMiddleware",
|
||||
"cms.middleware.language.LanguageCookieMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "project.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [
|
||||
PROJECT_DIR / "templates",
|
||||
],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"sekizai.context_processors.sekizai",
|
||||
"cms.context_processors.cms_settings",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "project.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.contrib.gis.db.backends.postgis", # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
# "NAME": "fragdenstaat_de",
|
||||
"NAME": "govplan",
|
||||
"USER": "govplan",
|
||||
"PASSWORD": "govplan",
|
||||
"HOST": "localhost", # Set to empty string for localhost. Not used with sqlite3.
|
||||
"PORT": "5432", # Set to empty string for default. Not used with sqlite3.
|
||||
}
|
||||
}
|
||||
GDAL_LIBRARY_PATH = os.environ.get("GDAL_LIBRARY_PATH")
|
||||
GEOS_LIBRARY_PATH = os.environ.get("GEOS_LIBRARY_PATH")
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/4.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = "de"
|
||||
LANGUAGES = [("de", _("German"))]
|
||||
|
||||
|
||||
TIME_ZONE = "UTC"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/4.1/howto/static-files/
|
||||
|
||||
STATIC_URL = "static/"
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
# AUTH_USER_MODEL = "account.User"
|
||||
|
||||
TAGGIT_CASE_INSENSITIVE = True
|
||||
TAGGIT_STRIP_UNICODE_WHEN_SLUGIFYING = True
|
||||
|
||||
LOGIN_URL = "account-login"
|
||||
X_FRAME_OPTIONS = "SAMEORIGIN"
|
||||
|
||||
# Django CMS
|
||||
|
||||
CMS_TEMPLATES = [
|
||||
("froide_govplan/base.html", "Govplan base template"),
|
||||
]
|
||||
|
||||
# Froide
|
||||
|
||||
SITE_ID = 1
|
||||
SITE_NAME = "GovPlan"
|
||||
SITE_URL = "http://localhost:8000"
|
||||
|
||||
FROIDE_CONFIG = {
|
||||
"bounce_enabled": False,
|
||||
"bounce_format": "bounce+{token}@example.com",
|
||||
"bounce_max_age": 60 * 60 * 24 * 14, # 14 days
|
||||
"bounce_format": "bounce+{token}@example.com",
|
||||
"unsubscribe_enabled": False,
|
||||
"unsubscribe_format": "unsub+{token}@example.com",
|
||||
}
|
||||
|
||||
# Govplan settings
|
||||
|
||||
GOVPLAN_NAME = "GovPlan"
|
||||
GOVPLAN_ENABLE_FOIREQUEST = False
|
||||
38
project/templates/base.html
Normal file
38
project/templates/base.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{% load i18n %}{% load static %}{% load cms_tags %}{% load sekizai_tags %}<!DOCTYPE html>
|
||||
<html lang="{{ LANGUAGE_CODE }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="language" content="{{ LANGUAGE_CODE }}" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>{% block title %}{% page_attribute "page_title" %} - {{ SITE_NAME }}{% endblock %}</title>
|
||||
|
||||
{% block header_font %}{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||
{% block extra_css %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
{% render_block "css" %}
|
||||
|
||||
{% block meta %}
|
||||
{# Translators: meta description #}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body {% if request.user.is_authenticated %}data-user="{{ request.user.id }}" data-useremail="{{ request.user.email }}"{% endif %}{% block body_extra_attributes %}{% endblock %}>
|
||||
{% cms_toolbar %}
|
||||
{% block body_tag %}{% block body %}{% block main %}{% endblock %}{% endblock %}{% endblock %}
|
||||
{% block extra_footer %}{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||
{% endblock %}
|
||||
{% render_block "js" %}
|
||||
|
||||
{% block below_scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
9
project/templates/cms/page.html
Normal file
9
project/templates/cms/page.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% load cms_tags %}
|
||||
|
||||
{% block body %}
|
||||
{% block app_body %}
|
||||
{% placeholder "content" %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
3
project/templates/header.html
Normal file
3
project/templates/header.html
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<header id="header" class="header container d-flex justify-content-between align-items-center pt-4 pt-md-5 pb-2">
|
||||
|
||||
</header>
|
||||
5
project/templates/header_reduced.html
Normal file
5
project/templates/header_reduced.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{% extends "header.html" %}
|
||||
|
||||
{% block nav_search %}{% endblock %}
|
||||
|
||||
{% block nav %}{% endblock nav %}
|
||||
0
project/templates/snippets/meta.html
Normal file
0
project/templates/snippets/meta.html
Normal file
30
project/urls.py
Normal file
30
project/urls.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"""project URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.1/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 include, path
|
||||
|
||||
# from froide_govplan.admin import govplan_admin_site
|
||||
|
||||
urlpatterns = [
|
||||
path(
|
||||
"follow/",
|
||||
include("froide.follow.urls", namespace="follow"),
|
||||
),
|
||||
# path("account/", include("froide.account.urls")),
|
||||
] + [
|
||||
path("admin/", admin.site.urls),
|
||||
path("", include("cms.urls")),
|
||||
]
|
||||
16
project/wsgi.py
Normal file
16
project/wsgi.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for project project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
Loading…
Add table
Add a link
Reference in a new issue