Esempio n. 1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gevent.pywsgi import WSGIServer
from izppy.application import setup_app

app = setup_app()
http_server = WSGIServer(('', 8080), app)
http_server.serve_forever()
Esempio n. 2
0
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from izppy.application import setup_app
app = setup_app()
http_server = HTTPServer(WSGIContainer(app))
http_server.listen(8080)
IOLoop.instance().start()
Esempio n. 3
0
from izppy.models import User

from izppy.application import setup_app
b = setup_app()
#b.run()
a = User(username='******', email="*****@*****.**", _password='******')
db.session.add(a)
db.session.commit()
Esempio n. 4
0
from izppy.models import User

from izppy.application import setup_app
b=setup_app()
#b.run()
a=User(username='******',email="*****@*****.**",_password='******')
db.session.add(a)
db.session.commit()
Esempio n. 5
0
    :license: BSD, see LICENSE for more details.
"""
from flask.ext.script import Server, Manager, prompt_bool
from izppy.application import setup_app
from izppy.extensions import db
from izppy.models.users import User
import uuid
"""
usage: provide a command for izppy.
python manager.py runserver: use to run a flask development server.
python manager.py createall: use to create all database tables. But MUST create databese first.
python manager.py dropall: use to drop all database tables.
python manager.py createuse: use to create a user.(use uuid module)
"""

manager = Manager(setup_app())
manager.add_command("runserver", Server('0.0.0.0', port=5000))


@manager.option('-r', '--role', dest='role', default="member")
def createuse(role):
    "create a user."
    user = User()
    info = unicode(uuid.uuid4())
    user.username, user.email, user.password = info.split('-')[:3]
    user.email = user.email + u"@izptec.com"
    password = info.split('-')[2]
    if role == "admin":
        user.role = User.ADMIN
    elif role == "moderator":
        user.role = User.MODERATOR