Merge pull request #65 from plers-org/sm/#63

Sm/#63
This commit is contained in:
NKEY
2025-05-31 00:58:43 +09:00
committed by GitHub
9 changed files with 42 additions and 0 deletions

8
common/utils/mongodb.py Normal file
View File

@@ -0,0 +1,8 @@
import mongoengine
from django.conf import settings
def connect_colio_mongo():
mongoengine.connect(
db=settings.MONGODB_NAME,
host=settings.MONGODB_URI
)

View File

@@ -65,6 +65,7 @@ INSTALLED_APPS = [
'projects',
'codes',
'notifications',
'nocodetools',
]
MIDDLEWARE = [
@@ -102,6 +103,9 @@ WSGI_APPLICATION = 'config.wsgi.application'
# Database
# https://docs.djangoproject.com/en/5.1/ref/settings/#databases
MONGODB_URI = env("MONGODB_URI")
MONGODB_NAME = env('MONGODB_NAME')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',

0
nocodetools/__init__.py Normal file
View File

3
nocodetools/admin.py Normal file
View File

@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

9
nocodetools/apps.py Normal file
View File

@@ -0,0 +1,9 @@
from django.apps import AppConfig
from common.utils.mongodb import connect_colio_mongo
class NocodetoolsConfig(AppConfig):
# default_auto_field = 'django.db.models.BigAutoField'
name = 'nocodetools'
def ready(self):
connect_colio_mongo()

14
nocodetools/models.py Normal file
View File

@@ -0,0 +1,14 @@
from django.db import models
import mongoengine as me
class Element(me.EmbeddedDocument):
element_type = me.StringField()
content = me.StringField()
css = me.DictField()
class Page(me.Document):
cut = me.IntField()
elements = me.ListField(me.EmbeddedDocumentField(Element))
created_at = me.DateTimeField()
updated_at = me.DateTimeField()

3
nocodetools/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

1
nocodetools/views.py Normal file
View File

@@ -0,0 +1 @@
# views.py

Binary file not shown.