diff --git a/templates/app_template/.github/workflows/django.yml b/templates/app_template/.github/workflows/django.yml deleted file mode 100644 index 9766b45..0000000 --- a/templates/app_template/.github/workflows/django.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Django CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.7, 3.8, 3.9] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Run Tests - run: | - python manage.py test diff --git a/templates/app_template/__init__.py-tpl b/templates/app_template/__init__.py-tpl deleted file mode 100644 index e69de29..0000000 diff --git a/templates/app_template/admin.py-tpl b/templates/app_template/admin.py-tpl deleted file mode 100644 index 8c38f3f..0000000 --- a/templates/app_template/admin.py-tpl +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/templates/app_template/apps.py-tpl b/templates/app_template/apps.py-tpl deleted file mode 100644 index 644f491..0000000 --- a/templates/app_template/apps.py-tpl +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class {{ camel_case_app_name }}Config(AppConfig): - default_auto_field = 'django_mongodb_backend.fields.ObjectIdAutoField' - name = 'apps.{{ app_name }}' diff --git a/templates/app_template/migrations/__init__.py-tpl b/templates/app_template/migrations/__init__.py-tpl deleted file mode 100644 index e69de29..0000000 diff --git a/templates/app_template/models.py-tpl b/templates/app_template/models.py-tpl deleted file mode 100644 index 71a8362..0000000 --- a/templates/app_template/models.py-tpl +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/templates/app_template/templates/app_name.html b/templates/app_template/templates/app_name.html deleted file mode 100644 index e5c9fbb..0000000 --- a/templates/app_template/templates/app_name.html +++ /dev/null @@ -1,552 +0,0 @@ -{% load static webpack_loader %} - - - - {% stylesheet_pack 'app' %} - - - - - - - - Dashboard Template ยท Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-

Dashboard

-
-
- - -
- -
-
- -

Section title

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#HeaderHeaderHeaderHeader
1,001randomdataplaceholdertext
1,002placeholderirrelevantvisuallayout
1,003datarichdashboardtabular
1,003informationplaceholderillustrativedata
1,004textrandomlayoutdashboard
1,005dashboardirrelevanttextplaceholder
1,006dashboardillustrativerichdata
1,007placeholdertabularinformationirrelevant
1,008randomdataplaceholdertext
1,009placeholderirrelevantvisuallayout
1,010datarichdashboardtabular
1,011informationplaceholderillustrativedata
1,012textplaceholderlayoutdashboard
1,013dashboardirrelevanttextvisual
1,014dashboardillustrativerichdata
1,015randomtabularinformationtext
-
-
-
-
- - - {% javascript_pack 'app' %} - - diff --git a/templates/app_template/tests.py-tpl b/templates/app_template/tests.py-tpl deleted file mode 100644 index 7ce503c..0000000 --- a/templates/app_template/tests.py-tpl +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/templates/app_template/urls.py b/templates/app_template/urls.py deleted file mode 100644 index cacc09a..0000000 --- a/templates/app_template/urls.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.urls import path - -from . import views - -urlpatterns = [ - path("", views.HomeView.as_view(), name="home"), -] diff --git a/templates/app_template/views.py-tpl b/templates/app_template/views.py-tpl deleted file mode 100644 index 2d07c3e..0000000 --- a/templates/app_template/views.py-tpl +++ /dev/null @@ -1,7 +0,0 @@ -from django.views.generic import TemplateView - -# Create your views here. - - -class {{ camel_case_app_name}}View(TemplateView): - template_name = '{{ app_name }}.html' diff --git a/templates/frontend_template/project_name/.gitignore b/templates/frontend_template/project_name/.gitignore deleted file mode 100644 index ddcb880..0000000 --- a/templates/frontend_template/project_name/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# dependencies -node_modules - -# production -build - -# misc -.DS_Store - -npm-debug.log -yarn-error.log -yarn.lock -.yarnclean -.vscode -.idea diff --git a/templates/frontend_template/project_name/README.md b/templates/frontend_template/project_name/README.md deleted file mode 100644 index 0b0d8e0..0000000 --- a/templates/frontend_template/project_name/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# README - -This project was created with [python-webpack-boilerplate](https://github.com/AccordBox/python-webpack-boilerplate) - -## Available Scripts - -In the project directory, you can run: - -### `npm run start` - -`npm run start` will launch a server process, which makes `live reloading` possible. - -If you change JS or SCSS files, the web page would auto refresh after the change. Now the server is working on port 9091 by default, but you can change it in `webpack/webpack.config.dev.js` - -### `npm run watch` - -run webpack in `watch` mode. - -### `npm run build` - -[production mode](https://webpack.js.org/guides/production/), Webpack would focus on minified bundles, lighter weight source maps, and optimized assets to improve load time. diff --git a/templates/frontend_template/project_name/vendors/.gitkeep b/templates/frontend_template/project_name/vendors/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/templates/frontend_template/project_name/vendors/images/.gitkeep b/templates/frontend_template/project_name/vendors/images/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/templates/frontend_template/project_name/vendors/images/mongodb.ico b/templates/frontend_template/project_name/vendors/images/mongodb.ico deleted file mode 100644 index 237f3bb..0000000 Binary files a/templates/frontend_template/project_name/vendors/images/mongodb.ico and /dev/null differ diff --git a/templates/frontend_template/project_name/vendors/images/sample.jpg b/templates/frontend_template/project_name/vendors/images/sample.jpg deleted file mode 100644 index 257c5dc..0000000 Binary files a/templates/frontend_template/project_name/vendors/images/sample.jpg and /dev/null differ diff --git a/templates/frontend_template/project_name/vendors/images/webpack.png b/templates/frontend_template/project_name/vendors/images/webpack.png deleted file mode 100644 index 6d788d5..0000000 Binary files a/templates/frontend_template/project_name/vendors/images/webpack.png and /dev/null differ diff --git a/templates/frontend_template/project_name/webpack/webpack.common.js b/templates/frontend_template/project_name/webpack/webpack.common.js deleted file mode 100644 index 9d82a49..0000000 --- a/templates/frontend_template/project_name/webpack/webpack.common.js +++ /dev/null @@ -1,71 +0,0 @@ -const glob = require("glob"); -const Path = require("path"); -const { CleanWebpackPlugin } = require("clean-webpack-plugin"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const WebpackAssetsManifest = require("webpack-assets-manifest"); - -const getEntryObject = () => { - const entries = {}; - // for javascript/typescript entry file - glob - .sync(Path.join(__dirname, "../src/application/*.{js,ts}")) - .forEach((path) => { - const name = Path.basename(path); - const extension = Path.extname(path); - const entryName = name.replace(extension, ""); - if (entryName in entries) { - throw new Error(`Entry file conflict: ${entryName}`); - } - entries[entryName] = path; - }); - return entries; -}; - -module.exports = { - entry: getEntryObject(), - output: { - path: Path.join(__dirname, "../build"), - filename: "js/[name].js", - publicPath: "/static/", - assetModuleFilename: "[path][name][ext]", - }, - optimization: { - splitChunks: { - chunks: "all", - }, - - runtimeChunk: "single", - }, - plugins: [ - new CleanWebpackPlugin(), - new CopyWebpackPlugin({ - patterns: [ - { from: Path.resolve(__dirname, "../vendors"), to: "vendors" }, - ], - }), - new WebpackAssetsManifest({ - entrypoints: true, - output: "manifest.json", - writeToDisk: true, - publicPath: true, - }), - ], - resolve: { - alias: { - "~": Path.resolve(__dirname, "../src"), - }, - }, - module: { - rules: [ - { - test: /\.mjs$/, - include: /node_modules/, - type: "javascript/auto", - }, - { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, - type: "asset", - }, - ], - }, -}; diff --git a/templates/frontend_template/project_name/webpack/webpack.config.dev.js b/templates/frontend_template/project_name/webpack/webpack.config.dev.js deleted file mode 100644 index d02292a..0000000 --- a/templates/frontend_template/project_name/webpack/webpack.config.dev.js +++ /dev/null @@ -1,73 +0,0 @@ -const Path = require("path"); -const Webpack = require("webpack"); -const { merge } = require("webpack-merge"); -const StylelintPlugin = require("stylelint-webpack-plugin"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const ESLintPlugin = require("eslint-webpack-plugin"); - -const common = require("./webpack.common.js"); - -module.exports = merge(common, { - target: "web", - mode: "development", - devtool: "inline-source-map", - output: { - chunkFilename: "js/[name].chunk.js", - publicPath: "http://localhost:9091/", - }, - devServer: { - hot: true, - host: "0.0.0.0", - port: 9091, - headers: { - "Access-Control-Allow-Origin": "*", - }, - devMiddleware: { - writeToDisk: true, - }, - }, - plugins: [ - new Webpack.DefinePlugin({ - "process.env.NODE_ENV": JSON.stringify("development"), - }), - new StylelintPlugin({ - files: Path.resolve(__dirname, "../src/**/*.s?(a|c)ss"), - }), - new ESLintPlugin({ - extensions: "js", - emitWarning: true, - files: Path.resolve(__dirname, "../src"), - }), - new MiniCssExtractPlugin({ - filename: "css/[name].css", - chunkFilename: "css/[id].css", - }), - ], - module: { - rules: [ - { - test: /\.html$/i, - loader: "html-loader", - }, - { - test: /\.js$/, - include: Path.resolve(__dirname, "../src"), - loader: "babel-loader", - }, - { - test: /\.s?css$/i, - use: [ - MiniCssExtractPlugin.loader, - { - loader: "css-loader", - options: { - sourceMap: true, - }, - }, - "postcss-loader", - "sass-loader", - ], - }, - ], - }, -}); diff --git a/templates/frontend_template/project_name/webpack/webpack.config.prod.js b/templates/frontend_template/project_name/webpack/webpack.config.prod.js deleted file mode 100644 index 4a0dd8f..0000000 --- a/templates/frontend_template/project_name/webpack/webpack.config.prod.js +++ /dev/null @@ -1,41 +0,0 @@ -const Webpack = require("webpack"); -const { merge } = require("webpack-merge"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const common = require("./webpack.common.js"); - -module.exports = merge(common, { - mode: "production", - devtool: "source-map", - bail: true, - output: { - filename: "js/[name].[chunkhash:8].js", - chunkFilename: "js/[name].[chunkhash:8].chunk.js", - }, - plugins: [ - new Webpack.DefinePlugin({ - "process.env.NODE_ENV": JSON.stringify("production"), - }), - new MiniCssExtractPlugin({ - filename: "css/[name].[contenthash].css", - chunkFilename: "css/[id].[contenthash].css", - }), - ], - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - use: "babel-loader", - }, - { - test: /\.s?css/i, - use: [ - MiniCssExtractPlugin.loader, - "css-loader", - "postcss-loader", - "sass-loader", - ], - }, - ], - }, -}); diff --git a/templates/frontend_template/project_name/webpack/webpack.config.watch.js b/templates/frontend_template/project_name/webpack/webpack.config.watch.js deleted file mode 100644 index e8796cb..0000000 --- a/templates/frontend_template/project_name/webpack/webpack.config.watch.js +++ /dev/null @@ -1,61 +0,0 @@ -const Path = require("path"); -const Webpack = require("webpack"); -const { merge } = require("webpack-merge"); -const StylelintPlugin = require("stylelint-webpack-plugin"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const ESLintPlugin = require("eslint-webpack-plugin"); - -const common = require("./webpack.common.js"); - -module.exports = merge(common, { - target: "web", - mode: "development", - devtool: "inline-source-map", - output: { - chunkFilename: "js/[name].chunk.js", - }, - plugins: [ - new Webpack.DefinePlugin({ - "process.env.NODE_ENV": JSON.stringify("development"), - }), - new StylelintPlugin({ - files: Path.resolve(__dirname, "../src/**/*.s?(a|c)ss"), - }), - new ESLintPlugin({ - extensions: "js", - emitWarning: true, - files: Path.resolve(__dirname, "../src"), - }), - new MiniCssExtractPlugin({ - filename: "css/[name].css", - chunkFilename: "css/[id].css", - }), - ], - module: { - rules: [ - { - test: /\.html$/i, - loader: "html-loader", - }, - { - test: /\.js$/, - include: Path.resolve(__dirname, "../src"), - loader: "babel-loader", - }, - { - test: /\.s?css$/i, - use: [ - MiniCssExtractPlugin.loader, - { - loader: "css-loader", - options: { - sourceMap: true, - }, - }, - "postcss-loader", - "sass-loader", - ], - }, - ], - }, -}); diff --git a/templates/home_template/__init__.py b/templates/home_template/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/templates/home_template/apps.py b/templates/home_template/apps.py deleted file mode 100644 index 5f7be0a..0000000 --- a/templates/home_template/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class HomeAppConfig(AppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - name = "home" diff --git a/templates/home_template/migrations/0001_initial.py b/templates/home_template/migrations/0001_initial.py deleted file mode 100644 index c437c7f..0000000 --- a/templates/home_template/migrations/0001_initial.py +++ /dev/null @@ -1,35 +0,0 @@ -# Generated by Django 5.0.11.dev20250107212806 on 2025-01-19 02:11 - -import django.db.models.deletion -from django.db import migrations, models - - -class Migration(migrations.Migration): - initial = True - - dependencies = [ - ("wagtailcore", "0001_initial"), - ] - - operations = [ - migrations.CreateModel( - name="HomePage", - fields=[ - ( - "page_ptr", - models.OneToOneField( - auto_created=True, - on_delete=django.db.models.deletion.CASCADE, - parent_link=True, - primary_key=True, - serialize=False, - to="wagtailcore.page", - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - ] diff --git a/templates/home_template/migrations/0002_create_homepage.py b/templates/home_template/migrations/0002_create_homepage.py deleted file mode 100644 index 4c02bef..0000000 --- a/templates/home_template/migrations/0002_create_homepage.py +++ /dev/null @@ -1,86 +0,0 @@ -from bson import ObjectId -from django.db import migrations - -# Do not use settings in migrations under normal circumstances. -from django.conf import settings - - -def create_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model("contenttypes.ContentType") - Page = apps.get_model("wagtailcore.Page") - Site = apps.get_model("wagtailcore.Site") - HomePage = apps.get_model("home.HomePage") - - # Delete the default homepage - # If migration is run multiple times, it may have already been deleted - Page.objects.filter(id=ObjectId("000000000000000000000001")).delete() - - # Create content type for homepage model - homepage_content_type, __ = ContentType.objects.get_or_create( - model="homepage", app_label="home" - ) - - # Why this is needed in MongoDB and not in PostgreSQL? - locale = None - if settings.DATABASES["default"]["ENGINE"] == "django_mongodb_backend": - Locale = apps.get_model("wagtailcore.Locale") - locale = Locale.objects.get(language_code="en") - - # Create a new homepage - homepage_attrs = { - "title": "Home", - "draft_title": "Home", - "slug": "home", - "content_type": homepage_content_type, - "path": "00010001", - "depth": 1, - "numchild": 0, - "url_path": "/home/", - } - # Add the locale only if it's defined - if locale: - homepage_attrs["locale"] = locale - - homepage = HomePage.objects.create(**homepage_attrs) - - # Create a site with the new homepage set as the root - Site.objects.create(hostname="localhost", root_page=homepage, is_default_site=True) - - -def remove_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model("contenttypes.ContentType") - HomePage = apps.get_model("home.HomePage") - - # Delete the default homepage - # Page and Site objects CASCADE - HomePage.objects.filter(slug="home", depth=2).delete() - - # Delete content type for homepage model - ContentType.objects.filter(model="homepage", app_label="home").delete() - - -def create_locale(apps, schema_editor): - Locale = apps.get_model("wagtailcore", "Locale") - # Replace 'en' with your desired language code and add other fields as necessary. - Locale.objects.create(language_code="en") - - -def remove_locale(apps, schema_editor): - Locale = apps.get_model("wagtailcore", "Locale") - # Replace 'en' with the language code used in create_locale - Locale.objects.filter(language_code="en").delete() - - -class Migration(migrations.Migration): - dependencies = [ - ("home", "0001_initial"), - ] - - operations = [ - migrations.RunPython(create_homepage, remove_homepage), - ] - - if settings.DATABASES["default"]["ENGINE"] == "django_mongodb_backend": - operations.insert(0, migrations.RunPython(create_locale, remove_locale)) diff --git a/templates/home_template/migrations/__init__.py b/templates/home_template/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/templates/home_template/models.py b/templates/home_template/models.py deleted file mode 100644 index f24c860..0000000 --- a/templates/home_template/models.py +++ /dev/null @@ -1,5 +0,0 @@ -from wagtail.models import Page - - -class HomePage(Page): - pass diff --git a/templates/home_template/static/css/welcome_page.css b/templates/home_template/static/css/welcome_page.css deleted file mode 100644 index bad2933..0000000 --- a/templates/home_template/static/css/welcome_page.css +++ /dev/null @@ -1,184 +0,0 @@ -html { - box-sizing: border-box; -} - -*, -*:before, -*:after { - box-sizing: inherit; -} - -body { - max-width: 960px; - min-height: 100vh; - margin: 0 auto; - padding: 0 15px; - color: #231f20; - font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif; - line-height: 1.25; -} - -a { - background-color: transparent; - color: #308282; - text-decoration: underline; -} - -a:hover { - color: #ea1b10; -} - -h1, -h2, -h3, -h4, -h5, -p, -ul { - padding: 0; - margin: 0; - font-weight: 400; -} - -svg:not(:root) { - overflow: hidden; -} - -.header { - display: flex; - justify-content: space-between; - align-items: center; - padding-top: 20px; - padding-bottom: 10px; - border-bottom: 1px solid #e6e6e6; -} - -.logo { - width: 150px; - margin-inline-end: 20px; -} - -.logo a { - display: block; -} - -.figure-logo { - max-width: 150px; - max-height: 55.1px; -} - -.release-notes { - font-size: 14px; -} - -.main { - padding: 40px 0; - margin: 0 auto; - text-align: center; -} - -.figure-space { - max-width: 265px; -} - -@keyframes pos { - 0%, 100% { - transform: rotate(-6deg); - } - 50% { - transform: rotate(6deg); - } -} - -.egg { - fill: #43b1b0; - animation: pos 3s ease infinite; - transform: translateY(50px); - transform-origin: 50% 80%; -} - -.main-text { - max-width: 400px; - margin: 5px auto; -} - -.main-text h1 { - font-size: 22px; -} - -.main-text p { - margin: 15px auto 0; -} - -.footer { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - border-top: 1px solid #e6e6e6; - padding: 10px; -} - -.option { - display: block; - padding: 10px 10px 10px 34px; - position: relative; - text-decoration: none; -} - -.option svg { - width: 24px; - height: 24px; - fill: gray; - border: 1px solid #d9d9d9; - padding: 5px; - border-radius: 100%; - top: 10px; - inset-inline-start: 0; - position: absolute; -} - -.option h2 { - font-size: 19px; - text-decoration: underline; -} - -.option p { - padding-top: 3px; - color: #231f20; - font-size: 15px; - font-weight: 300; -} - -@media (max-width: 996px) { - body { - max-width: 780px; - } -} - -@media (max-width: 767px) { - .option { - flex: 0 0 50%; - } -} - -@media (max-width: 599px) { - .main { - padding: 20px 0; - } - - .figure-space { - max-width: 200px; - } - - .footer { - display: block; - width: 300px; - margin: 0 auto; - } -} - -@media (max-width: 360px) { - .header-link { - max-width: 100px; - } -} diff --git a/templates/home_template/static/js/bson_adapter.js b/templates/home_template/static/js/bson_adapter.js deleted file mode 100644 index e845999..0000000 --- a/templates/home_template/static/js/bson_adapter.js +++ /dev/null @@ -1,17 +0,0 @@ -(function() { - class ObjectId { - constructor(value) { - this.value = value; - } - - toString() { - return this.value; - } - - static fromArgs(args) { - return new ObjectId(args[0]); - } - } - - window.telepath.register('ObjectId', ObjectId); -})(); diff --git a/templates/home_template/telepath_adapters/__init__.py b/templates/home_template/telepath_adapters/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/templates/home_template/telepath_adapters/bson_adapter.py b/templates/home_template/telepath_adapters/bson_adapter.py deleted file mode 100644 index 2d3039d..0000000 --- a/templates/home_template/telepath_adapters/bson_adapter.py +++ /dev/null @@ -1,12 +0,0 @@ -from bson import ObjectId -from wagtail.telepath import Adapter, register - - -class ObjectIdAdapter(Adapter): - js_constructor = "ObjectId" - - def js_args(self, obj): - return [str(obj)] - - -register(ObjectId, ObjectIdAdapter) diff --git a/templates/home_template/wagtail_hooks.py b/templates/home_template/wagtail_hooks.py deleted file mode 100644 index f83e308..0000000 --- a/templates/home_template/wagtail_hooks.py +++ /dev/null @@ -1,7 +0,0 @@ -from wagtail import hooks - - -@hooks.register("insert_editor_js") -def add_objectid_js(): - return """ - """ diff --git a/templates/project_template/project_name/__init__.py b/templates/project_template/project_name/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/templates/project_template/project_name/mongo_apps.py b/templates/project_template/project_name/mongo_apps.py deleted file mode 100644 index 0f44846..0000000 --- a/templates/project_template/project_name/mongo_apps.py +++ /dev/null @@ -1,67 +0,0 @@ -from django.contrib.admin.apps import AdminConfig -from django.contrib.auth.apps import AuthConfig -from django.contrib.contenttypes.apps import ContentTypesConfig - - -from taggit.apps import TaggitAppConfig -from wagtail.documents.apps import WagtailDocsAppConfig -from wagtail.contrib.redirects.apps import WagtailRedirectsAppConfig -from wagtail.images.apps import WagtailImagesAppConfig -from wagtail.search.apps import WagtailSearchAppConfig -from wagtail.admin.apps import WagtailAdminAppConfig -from wagtail.apps import WagtailAppConfig -from wagtail.contrib.forms.apps import WagtailFormsAppConfig -from wagtail.embeds.apps import WagtailEmbedsAppConfig -from wagtail.users.apps import WagtailUsersAppConfig - - -class MongoTaggitAppConfig(TaggitAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailDocsAppConfig(WagtailDocsAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoAdminConfig(AdminConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoAuthConfig(AuthConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoContentTypesConfig(ContentTypesConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailRedirectsAppConfig(WagtailRedirectsAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailImagesAppConfig(WagtailImagesAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailSearchAppConfig(WagtailSearchAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailAdminAppConfig(WagtailAdminAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailAppConfig(WagtailAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailFormsAppConfig(WagtailFormsAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailEmbedsAppConfig(WagtailEmbedsAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" - - -class MongoWagtailUsersAppConfig(WagtailUsersAppConfig): - default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField" diff --git a/templates/project_template/project_name/settings/__init__.py b/templates/project_template/project_name/settings/__init__.py deleted file mode 100644 index dd8469c..0000000 --- a/templates/project_template/project_name/settings/__init__.py +++ /dev/null @@ -1,159 +0,0 @@ -import os - -from bson import ObjectId -from django_mongodb_backend import parse_uri - - -PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - -BASE_DIR = os.path.dirname(PROJECT_DIR) - -DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField" - -INSTALLED_APPS = [ - "{{ project_name }}.mongo_apps.MongoWagtailFormsAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailRedirectsAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailEmbedsAppConfig", - "wagtail.sites", - "{{ project_name }}.mongo_apps.MongoWagtailUsersAppConfig", - "wagtail.snippets", - "{{ project_name }}.mongo_apps.MongoWagtailDocsAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailImagesAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailSearchAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailAdminAppConfig", - "{{ project_name }}.mongo_apps.MongoWagtailAppConfig", - "modelcluster", - "{{ project_name }}.mongo_apps.MongoTaggitAppConfig", - "{{ project_name }}.mongo_apps.MongoAdminConfig", - "{{ project_name }}.mongo_apps.MongoAuthConfig", - "{{ project_name }}.mongo_apps.MongoContentTypesConfig", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "django_extensions", - "webpack_boilerplate", - "debug_toolbar", - "home", - "django_mongodb_extensions", -] - -MIGRATION_MODULES = { - "admin": "mongo_migrations.admin", - "auth": "mongo_migrations.auth", - "contenttypes": "mongo_migrations.contenttypes", - "taggit": "mongo_migrations.taggit", - "wagtaildocs": "mongo_migrations.wagtaildocs", - "wagtailredirects": "mongo_migrations.wagtailredirects", - "wagtailimages": "mongo_migrations.wagtailimages", - "wagtailsearch": "mongo_migrations.wagtailsearch", - "wagtailadmin": "mongo_migrations.wagtailadmin", - "wagtailcore": "mongo_migrations.wagtailcore", - "wagtailforms": "mongo_migrations.wagtailforms", - "wagtailembeds": "mongo_migrations.wagtailembeds", - "wagtailusers": "mongo_migrations.wagtailusers", -} - -DATABASES = { - "default": parse_uri( - os.environ.get("MONGODB_URI", "mongodb://localhost:27017/{{ project_name }}") - ) -} - -DEBUG = True - -ROOT_URLCONF = "{{ project_name }}.urls" - -STATICFILES_DIRS = [os.path.join(BASE_DIR, "frontend", "build")] - -WEBPACK_LOADER = { - "MANIFEST_FILE": os.path.join(BASE_DIR, "frontend", "build", "manifest.json") -} - -SECRET_KEY = "{{ secret_key }}" - -ALLOWED_HOSTS = ["*"] - -STATIC_URL = "static/" - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join("{{ project_name }}", "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", - ], - }, - }, -] - -MIDDLEWARE = [ - "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", - "django.middleware.security.SecurityMiddleware", - "wagtail.contrib.redirects.middleware.RedirectMiddleware", - "debug_toolbar.middleware.DebugToolbarMiddleware", -] - -WAGTAIL_SITE_NAME = "{{ project_name }}" - -INTERNAL_IPS = [ - "127.0.0.1", -] - -SITE_ID = ObjectId("000000000000000000000001") - - -DEBUG_TOOLBAR_PANELS = [ - "debug_toolbar.panels.history.HistoryPanel", - "debug_toolbar.panels.versions.VersionsPanel", - "debug_toolbar.panels.timer.TimerPanel", - "debug_toolbar.panels.settings.SettingsPanel", - "debug_toolbar.panels.headers.HeadersPanel", - "debug_toolbar.panels.request.RequestPanel", - "django_mongodb_extensions.debug_toolbar.panels.mql.MQLPanel", - "debug_toolbar.panels.staticfiles.StaticFilesPanel", - "debug_toolbar.panels.templates.TemplatesPanel", - "debug_toolbar.panels.alerts.AlertsPanel", - "debug_toolbar.panels.cache.CachePanel", - "debug_toolbar.panels.signals.SignalsPanel", - "debug_toolbar.panels.redirects.RedirectsPanel", - "debug_toolbar.panels.profiling.ProfilingPanel", -] - -LOGGING = { - "version": 1, - "disable_existing_loggers": False, - "formatters": { - "verbose": { - "format": "{levelname} {asctime} {module} {message}", - "style": "{", - }, - "simple": { - "format": "{levelname} {message}", - "style": "{", - }, - }, - "handlers": { - "console": { - "level": "DEBUG", - "class": "logging.StreamHandler", - "formatter": "verbose", - }, - }, - "loggers": { - "django": { - "handlers": ["console"], - "level": "DEBUG", - "propagate": True, - }, - }, -} diff --git a/templates/project_template/project_name/templates/404.html b/templates/project_template/project_name/templates/404.html deleted file mode 100644 index f19ab95..0000000 --- a/templates/project_template/project_name/templates/404.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "base.html" %} - -{% block title %}Page not found{% endblock %} - -{% block body_class %}template-404{% endblock %} - -{% block content %} -

Page not found

- -

Sorry, this page could not be found.

-{% endblock %} diff --git a/templates/project_template/project_name/templates/500.html b/templates/project_template/project_name/templates/500.html deleted file mode 100644 index 77379e5..0000000 --- a/templates/project_template/project_name/templates/500.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Internal server error - - - -

Internal server error

- -

Sorry, there seems to be an error. Please try again soon.

- - diff --git a/templates/project_template/project_name/templates/base.html b/templates/project_template/project_name/templates/base.html deleted file mode 100644 index 5d8b2bb..0000000 --- a/templates/project_template/project_name/templates/base.html +++ /dev/null @@ -1,70 +0,0 @@ -{% load static webpack_loader %} - - - - - - {% block title %}{% endblock %} - {% block title_suffix %}{% endblock %} - - - {% stylesheet_pack 'app' %} - {% block extra_css %}{# Override this in templates to add extra stylesheets #}{% endblock %} - - {% include 'favicon.html' %} - {% csrf_token %} - - -
-
- {% include 'header.html' %} - {% if messages %} -
- {% for message in messages %} - - {% endfor %} -
- {% endif %} -
- {% block content %}{% endblock %} -
-
- {% include 'footer.html' %} - {% include 'offcanvas.html' %} - {% javascript_pack 'app' %} - {% block extra_js %}{# Override this in templates to add extra javascript #}{% endblock %} - - diff --git a/templates/project_template/project_name/templates/favicon.html b/templates/project_template/project_name/templates/favicon.html deleted file mode 100644 index a7f0c0f..0000000 --- a/templates/project_template/project_name/templates/favicon.html +++ /dev/null @@ -1,2 +0,0 @@ -{% load static %} - diff --git a/templates/project_template/project_name/templates/footer.html b/templates/project_template/project_name/templates/footer.html deleted file mode 100644 index 6a6862d..0000000 --- a/templates/project_template/project_name/templates/footer.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/templates/project_template/project_name/templates/header.html b/templates/project_template/project_name/templates/header.html deleted file mode 100644 index 5456cde..0000000 --- a/templates/project_template/project_name/templates/header.html +++ /dev/null @@ -1,65 +0,0 @@ -
-
- -
-
diff --git a/templates/project_template/project_name/templates/offcanvas.html b/templates/project_template/project_name/templates/offcanvas.html deleted file mode 100644 index 29c1171..0000000 --- a/templates/project_template/project_name/templates/offcanvas.html +++ /dev/null @@ -1,38 +0,0 @@ -
-
- {{ current_site.site_name|default:"Django MongoDB" }} - -
-
- -
-
diff --git a/templates/project_template/project_name/urls.py b/templates/project_template/project_name/urls.py deleted file mode 100644 index 7706e1c..0000000 --- a/templates/project_template/project_name/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -from debug_toolbar.toolbar import debug_toolbar_urls -from django.urls import path, include -from django.contrib import admin -from .views import BaseView - - -urlpatterns = [ - path("django/", admin.site.urls), - path("wagtail/", include("wagtail.admin.urls")), - path("", BaseView.as_view(), name="base"), -] + debug_toolbar_urls() diff --git a/templates/project_template/project_name/utils.py b/templates/project_template/project_name/utils.py deleted file mode 100644 index c4fd679..0000000 --- a/templates/project_template/project_name/utils.py +++ /dev/null @@ -1,37 +0,0 @@ -from django.urls import URLResolver -import requests - - -def get_ec2_metadata(): - try: - # Step 1: Get the token - token_url = "http://169.254.169.254/latest/api/token" - headers = {"X-aws-ec2-metadata-token-ttl-seconds": "21600"} - response = requests.put(token_url, headers=headers) - response.raise_for_status() # Raise an error for bad responses - - token = response.text - - # Step 2: Use the token to get the instance metadata - metadata_url = "http://169.254.169.254/latest/meta-data/local-ipv4" - headers = {"X-aws-ec2-metadata-token": token} - response = requests.get(metadata_url, headers=headers) - response.raise_for_status() # Raise an error for bad responses - - metadata = response.text - return metadata - except requests.RequestException as e: - print(f"Error retrieving EC2 metadata: {e}") - return None - - -# Function to remove a specific URL pattern based on its route (including catch-all) -def remove_urlpattern(urlpatterns, route_to_remove): - urlpatterns[:] = [ - urlpattern - for urlpattern in urlpatterns - if not ( - isinstance(urlpattern, URLResolver) - and urlpattern.pattern._route == route_to_remove - ) - ] diff --git a/templates/project_template/project_name/views.py-tpl b/templates/project_template/project_name/views.py-tpl deleted file mode 100644 index 188d033..0000000 --- a/templates/project_template/project_name/views.py-tpl +++ /dev/null @@ -1,7 +0,0 @@ -from django.views.generic import TemplateView - -# Create your views here. - - -class BaseView(TemplateView): - template_name = 'base.html'