Code Monkey home page Code Monkey logo

tornado_sample's Introduction

Simple Tornado & Mongodb app using authentication


HTML demos for slidys, notifications & popup windows

# ----- to Run app: ------
sudo apt-get install python-dev
sudo apt-get build-dep python-dev

cd sample
pip install -r requirements.txt
python app.py

# ----- Run tests: ------
cd sample
python -m tornado.testing  discover

# ---- Run single test ------
cd sample
python -m tornado.testing  tests.test_client

# ----- Run Splinter Web Acceptance tests -------
apt-get install libxml2-dev libxslt-dev
pip install splinter
cd splinter
python -m tornado.testing  discover

tornado_sample's People

Contributors

bootandy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tornado_sample's Issues

using a property is redundant

Once the database attribute is added to the Application object it can be accessed with "self.application.database".

class Application(tornado.web.Application):
def init(self):
handlers = [
(r"/", MainHandler),
]

    settings = dict(
        autoescape=None,
    )
    tornado.web.Application.__init__(self, handlers, **settings)

    self.con = Connection('localhost', 27017)
    self.database = self.con["mongosample"]

class MainHandler(tornado.web.RequestHandler):
#@Property
#def db(self):
# return self.application.database

def get(self):
    new_comment = {
        "comment" : "what a nice page",
        "author" : "bobby",
        "time" : datetime.utcnow(),
    }

    self.application.database.comments.insert(new_comment)

    comments = self.application.db["comments"].find()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.