From 3978758721ca84a760ee9b42ca0ba1a179c40cbc Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Mon, 1 Jul 2024 11:15:37 -0300 Subject: [PATCH] feat(vote): initial setup votepeloclime site --- app/votepeloclima/__init__.py | 0 app/votepeloclima/settings.py | 144 ++++++++++++++++++++++++++++++++++ app/votepeloclima/urls.py | 38 +++++++++ 3 files changed, 182 insertions(+) create mode 100644 app/votepeloclima/__init__.py create mode 100644 app/votepeloclima/settings.py create mode 100644 app/votepeloclima/urls.py diff --git a/app/votepeloclima/__init__.py b/app/votepeloclima/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/votepeloclima/settings.py b/app/votepeloclima/settings.py new file mode 100644 index 00000000..979b3531 --- /dev/null +++ b/app/votepeloclima/settings.py @@ -0,0 +1,144 @@ +from pathlib import Path +from project.settings import * + + +# Root folder to this site config + +SITE_DIR = Path(__file__).resolve().parent + +# Databases + +DEFAULT_DB_SQLITE = BASE_DIR / "votepeloclima.sqlite3" + +DATABASES.update( + { + "default": env.db_url("CMS_DATABASE_URL", f"sqlite:///{DEFAULT_DB_SQLITE}"), + } +) + + +# Installed apps + +INSTALLED_APPS = [ + # "admin_styled", + # "tailwind", + # Override third apps templates + "contrib.ds.admin_style", + "djangocms_admin_style", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + # http://whitenoise.evans.io/en/stable/django.html#using-whitenoise-in-development + "whitenoise.runserver_nostatic", + "django.contrib.staticfiles", + "django.contrib.sites", + # + "adminsortable2", + # Django CMS + "cms", + "menus", + "treebeard", + "sekizai", + # Django Filer - optional, but used in most projects + "filer", + "easy_thumbnails", + # some content plugins - optional, but used in most projects + "djangocms_picture", + "djangocms_text_ckeditor", + "djangocms_video", + "djangocms_snippet", + # Third apps + "colorfield", + "compressor", + "captcha", + "django_select2", + "django_jsonform", + "djangocms_form_builder", + # My Apps + "contrib.bonde", + "contrib.ga", + + "contrib.ds", + "contrib.ds.accordion", + "contrib.ds.blocks", + "contrib.ds.card", + "contrib.ds.carousel", + "contrib.ds.counter", + "contrib.ds.grid", + "contrib.ds.link", + "contrib.ds.picture", + "contrib.ds.tooltip", + + "contrib.oauth", + # "adp.map" +] + +MIDDLEWARE = [ + # "django_prometheus.middleware.PrometheusBeforeMiddleware", + # + "django.middleware.security.SecurityMiddleware", + "project.middleware.WwwRedirectMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", + "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", + "contrib.bonde.middleware.SiteMiddleware", + "cms.middleware.user.CurrentUserMiddleware", + "cms.middleware.page.CurrentPageMiddleware", + "cms.middleware.toolbar.ToolbarMiddleware", + "cms.middleware.language.LanguageCookieMiddleware", + "contrib.oauth.middleware.NoDjangoAdminForEndUserMiddleware", + # + # "django_prometheus.middleware.PrometheusAfterMiddleware", +] + +# URLs + +ROOT_URLCONF = "votepeloclima.urls" + + +AUTHENTICATION_BACKENDS = ( + 'contrib.oauth.backends.OAuthBackend', + 'django.contrib.auth.backends.ModelBackend', +) + +# Static files + +STATICFILES_FINDERS += [ + # + "compressor.finders.CompressorFinder", +] + +COMPRESS_PRECOMPILERS = (("text/x-scss", "django_libsass.SassCompiler"),) + +# DjangoCMS +# Configurações inicials + +CMS_TEMPLATES = [ + ("ds/base.html", "[DS] Padrão"), + ("ds/base_navbar_footer.html", "[DS] Navbar + Footer"), + # ("ga/base.html", "Base Google Analytics"), +] + +CMS_PLACEHOLDER_CONF = {} + +DJANGOCMS_PICTURE_RESPONSIVE_IMAGES = True + +# DjangoCMS Form Builder Submodule + +DJANGOCMS_FORMS_REQUIRED_CSS_CLASS = "required" + +DJANGOCMS_FORMS_FORM_PLUGIN_CHILD_CLASSES = [ + "BlockPlugin", + "ButtonPlugin", +] + +# CKEDITOR_SETTINGS = { +# **CKEDITOR_SETTINGS, +# "colorButton_colors": "0F5427,20A54B,D8952A,F0A42B,C32C18,EA4F83,1D3D90,080808,222222,555555,F5F4F0,FFFFFF", +# } \ No newline at end of file diff --git a/app/votepeloclima/urls.py b/app/votepeloclima/urls.py new file mode 100644 index 00000000..ae62bc7e --- /dev/null +++ b/app/votepeloclima/urls.py @@ -0,0 +1,38 @@ +"""project URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.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.conf.urls.static import static +from django.conf import settings +from django.contrib import admin +from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.urls import path, include + + +urlpatterns = [ + # path("monitoring/", include("django_prometheus.urls")), + path("admin/", admin.site.urls), + path("select2/", include("django_select2.urls")), + path("", include("cms.urls")), +] + +urlpatterns += staticfiles_urlpatterns() + +handler404 = "contrib.frontend.views.error_404" +handler500 = "contrib.frontend.views.error_500" + +if settings.DEBUG: + urlpatterns.extend(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)) + +# urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)