Пример #1
0
import sqlalchemy

from flask.ext.script import Manager
from flask.ext.migrate import MigrateCommand

from fbone import create_app
from fbone.extensions import db
from fbone.utils import PROJECT_PATH, MALE
from fbone.modules.posting import Posting, Category

from urllib import urlopen
from bs4 import BeautifulSoup

from script import getCreated, getComp, getEmp, getMeta, getCategories

app = create_app()
manager = Manager(create_app)
manager.add_option('-c', '--config', dest='config', required=False)


@manager.command
def initdb():
    """Init/reset database."""

    try:
        db.drop_all()
    except sqlalchemy.exc.OperationalError:
        URI = app.config['SQLALCHEMY_DATABASE_URI'][:app.config['SQLALCHEMY_DATABASE_URI'].rfind('/')]
        engine = sqlalchemy.create_engine(URI)
        engine.execute("CREATE DATABASE fbone")
Пример #2
0
# -*- coding: utf-8 -*-

import os

from flask.ext.script import Manager, prompt, prompt_pass, prompt_bool

from fbone import create_app
from fbone.extensions import db
from fbone.models import User


manager = Manager(create_app())

from fbone import create_app
app = create_app()
project_root_path = os.path.join(os.path.dirname(app.root_path))


@manager.command
def run():
    """Run local server."""

    app.run()


@manager.command
def initdb():
    """Init/reset database."""

    db.drop_all()
    db.create_all()
Пример #3
0
    def create_app(self):
        """Create and return a testing flask app."""

        app = create_app(TestConfig)
        self.twill = Twill(app, port=3000)
        return app
Пример #4
0
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "fbone"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

# activate virtualenv
activate_this = os.path.join(os.environ["HOME"], ".virtualenvs", project,
                             "bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))

BASE_DIR = os.path.join(os.path.dirname(__file__))
if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from fbone import create_app
application = create_app()
Пример #5
0
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from fbone import create_app
if __name__ == '__main__':
	app = create_app()
	app.debug = True
	http_server = HTTPServer(WSGIContainer(app))
	http_server.listen(80)
	IOLoop.instance().start()
Пример #6
0
# -*- coding: utf-8 -*-

import sys, os, pwd

project = "fbone"

# Use instance folder, instead of env variables.
# specify dev/production config
#os.environ['%s_APP_CONFIG' % project.upper()] = ''
# http://code.google.com/p/modwsgi/wiki/ApplicationIssues#User_HOME_Environment_Variable
#os.environ['HOME'] = pwd.getpwuid(os.getuid()).pw_dir

# activate virtualenv
activate_this = os.path.join(os.environ["HOME"], ".virtualenvs", project, "bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))

BASE_DIR = os.path.join(os.path.dirname(__file__))
if BASE_DIR not in sys.path:
    sys.path.append(BASE_DIR)

# give wsgi the "application"
from fbone import create_app
application = create_app()
Пример #7
0
 def create_app(self):
     app = create_app(TestConfig)
     return app
    def create_app(self):
        """Create and return a testing flask app."""

        app = create_app(TestConfig)
        self.twill = Twill(app, port=3000)
        return app
Пример #9
0
 def create_app(self):
     app = create_app(TestConfig)
     return app
Пример #10
0
def create_app_run():
    return create_app()