Permalink
Browse files

added MongoEngine models

  • Loading branch information...
rochacbruno committed Oct 15, 2015
1 parent 5645de0 commit 88effa01b5ffd11f3fd7d5530f90591e421dd109
Showing with 16 additions and 11 deletions.
  1. +1 −1 requirements.txt
  2. +2 −9 wtf/db.py
  3. +5 −1 wtf/development_instance/config.cfg
  4. +8 −0 wtf/models.py
View
@@ -1,4 +1,4 @@
https://github.com/mitsuhiko/flask/tarball/master
dataset
flask-mongoengine
nose
Flask-Bootstrap
View
@@ -1,10 +1,3 @@
# coding: utf-8
from os import path
from flask import current_app
import dataset
def get_table(tablename):
database_name = current_app.config['DATABASE_NAME']
database_path = path.join(current_app.instance_path, database_name)
db = dataset.connect('sqlite:///{0}'.format(database_path))
return db[tablename]
from flask_mongoengine import MongoEngine
db = MongoEngine()
@@ -3,4 +3,8 @@ RUN_USE_RELOADER = True
RUN_HOST='localhost'
RUN_PORT=5000
DATABASE_NAME = 'noticias.db'
MEDIA_FOLDER = 'media_files'
MEDIA_FOLDER = 'media_files'
MONGODB_DB = "noticias"
MONGODB_HOST = "localhost" # substitua se utilizar um server remoto
MONGODB_PORT = 27017
View
@@ -0,0 +1,8 @@
# coding: utf-8
from .db import db
class Noticia(db.Document):
titulo = db.StringField()
texto = db.StringField()
imagem = db.StringField()

0 comments on commit 88effa0

Please sign in to comment.