8
common/utils/mongodb.py
Normal file
8
common/utils/mongodb.py
Normal 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
|
||||
)
|
||||
@@ -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
0
nocodetools/__init__.py
Normal file
3
nocodetools/admin.py
Normal file
3
nocodetools/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
9
nocodetools/apps.py
Normal file
9
nocodetools/apps.py
Normal 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
14
nocodetools/models.py
Normal 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
3
nocodetools/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
1
nocodetools/views.py
Normal file
1
nocodetools/views.py
Normal file
@@ -0,0 +1 @@
|
||||
# views.py
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user