예제 #1
0
파일: suite.py 프로젝트: Excelight/june
    def setUp(self):
        config = {'TESTING': True, 'WTF_CSRF_ENABLED': False}
        config['SECRET_KEY'] = 'secret-key-for-test'

        self.db_fd, self.db_file = tempfile.mkstemp()
        config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % self.db_file

        app = create_app(config)
        self.app = app

        self.client = app.test_client()

        db.create_all()

        if hasattr(self, 'prehook'):
            self.prehook()
예제 #2
0
    def setUp(self):
        config = {'TESTING': True, 'WTF_CSRF_ENABLED': False}
        config['SECRET_KEY'] = 'secret-key-for-test'

        self.db_fd, self.db_file = tempfile.mkstemp()
        config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % self.db_file

        app = create_app(config)
        self.app = app

        self.client = app.test_client()

        db.create_all()

        if hasattr(self, 'prehook'):
            self.prehook()
예제 #3
0
파일: manager.py 프로젝트: Best1a/june
def runserver(port=5000, config=CONFIG):
    """Runs a development server."""
    from gevent.wsgi import WSGIServer
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication

    port = int(port)
    app = create_app(config)

    @run_with_reloader
    def run_server():
        print('start server at: 127.0.0.1:%s' % port)
        http_server = WSGIServer(('', port), DebuggedApplication(app))
        http_server.serve_forever()

    run_server()
예제 #4
0
gevent.monkey.patch_all()

import os
import sys
import argparse
from flask_script import Manager, Command
from june.app import create_app

settings = os.path.abspath('./etc/settings.py')
if not os.path.exists(settings):
    settings = os.path.abspath('./etc/dev_config.py')

if 'JUNE_SETTINGS' not in os.environ:
    os.environ['JUNE_SETTINGS'] = settings

app = create_app()
from june.models import db
app.db = db

manager = Manager(app)


@manager.command
def runserver(port=5000, with_profile=False):
    """Runs a development server."""
    from flask import send_from_directory
    from gevent.wsgi import WSGIServer
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication
    from werkzeug.contrib.profiler import ProfilerMiddleware
예제 #5
0
파일: manager.py 프로젝트: Best1a/june
def createdb(config=CONFIG):
    """Create a database."""
    from june.models import db
    create_app(config)
    db.create_all()
예제 #6
0
파일: manager.py 프로젝트: Best1a/june
# coding: utf-8

import gevent.monkey
gevent.monkey.patch_all()

from flask.ext.script import Manager
from june.app import create_app

CONFIG = '_config/development.py'

manager = Manager(create_app())


@manager.command
def runserver(port=5000, config=CONFIG):
    """Runs a development server."""
    from gevent.wsgi import WSGIServer
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication

    port = int(port)
    app = create_app(config)

    @run_with_reloader
    def run_server():
        print('start server at: 127.0.0.1:%s' % port)
        http_server = WSGIServer(('', port), DebuggedApplication(app))
        http_server.serve_forever()

    run_server()
예제 #7
0
파일: manager.py 프로젝트: VTScn/june
# coding: utf-8

import gevent.monkey
gevent.monkey.patch_all()

import os
from flask.ext.script import Manager
from june.app import create_app

CONFIG = os.path.abspath('./etc/dev_config.py')

app = create_app(CONFIG)
manager = Manager(app)


@manager.command
def runserver(port=5000, with_profile=False):
    """Runs a development server."""
    from gevent.wsgi import WSGIServer
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication
    from werkzeug.contrib.profiler import ProfilerMiddleware

    port = int(port)

    if with_profile:
        f = open('./data/profile.log', 'w')
        wsgi = ProfilerMiddleware(app, f)
    else:
        wsgi = DebuggedApplication(app)
예제 #8
0
파일: manager.py 프로젝트: znetor/june
# coding: utf-8

import gevent.monkey

gevent.monkey.patch_all()

import os
import sys
from flask.ext.script import Manager
from june.app import create_app

CONFIG = os.path.abspath('./etc/dev_config.py')

app = create_app(CONFIG)
manager = Manager(app)


@manager.command
def runserver(port=5000, with_profile=False):
    """Runs a development server."""
    from gevent.wsgi import WSGIServer
    from werkzeug.serving import run_with_reloader
    from werkzeug.debug import DebuggedApplication
    from werkzeug.contrib.profiler import ProfilerMiddleware

    port = int(port)

    if with_profile:
        f = open('./data/profile.log', 'w')
        wsgi = ProfilerMiddleware(app, f)
    else:
예제 #9
0
파일: env.py 프로젝트: QingtianSky/june
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(cwd)
settings = os.path.join(cwd, 'etc/settings.py')
if not os.path.exists(settings):
    settings = os.path.join(cwd, 'etc/dev_config.py')

if 'JUNE_SETTINGS' not in os.environ:
    os.environ['JUNE_SETTINGS'] = settings

from june.app import create_app
from june.models import db
app = create_app()
# set the database url
config.set_main_option(
    'sqlalchemy.url',
    app.config.get('SQLALCHEMY_DATABASE_URI')
)
target_metadata = db.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
# my_important_option = config.get_main_option("my_important_option")
# ... etc.


def run_migrations_offline():
    """Run migrations in 'offline' mode.
예제 #10
0
from june.app import create_app

application = create_app()
예제 #11
0
파일: test_db.py 프로젝트: Best1a/june
 def setUp(self):
     app = create_app()
     self.db_fd, self.db_path = tempfile.mkstemp()
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///%s' % self.db_path
     app.config['TESTING'] = True
     self.app = app.test_client()
예제 #12
0
파일: test_front.py 프로젝트: Best1a/june
 def setUp(self):
     self.app = create_app()
     self.client = self.app.test_client()