示例#1
0
#
# Copyright © 2013 ccheng <*****@*****.**>
#
# Distributed under terms of the MIT license.

"""

"""

import urllib
from one_server import create_app, mongo
import one_server
import json
from bson.json_util import dumps

app = create_app('one_server.settings.DevConfig', env='dev')
test_app = app.test_client()
context = app.test_request_context('/')
context.push()

#clear all data.
mongo.db.user.remove()
mongo.db.comment.remove()
mongo.db.ride.remove()
mongo.db.passenger.remove()

one_server.init_db()
token = str(mongo.db.user.find_one({'nickname': 'asdf'})['_id'])

#This user is used to test some function need two users.
token2 = str(mongo.db.user.find_one({'nickname': 'fdsa'})['_id'])
示例#2
0
import one_server

app = one_server.create_app("one_server.settings.DevConfig", env="dev")
# app.run(port=10000, debug=True)
示例#3
0
#!/usr/bin/env python
import os

from flask.ext.script import Manager, Server
from one_server import create_app, mongo
from pymongo import GEO2D

env = os.environ.get('APPNAME_ENV', 'dev')
app = create_app('one_server.settings.%sConfig' % env.capitalize(), env=env)

manager = Manager(app)
manager.add_command("server", Server())

#@manager.command
#def init():
    #app = create_app('one_server.settings.DevConfig', env='dev')
    #context = app.test_request_context('/')
    #init_database()

if __name__ == "__main__":
    manager.run()