예제 #1
0
파일: app.py 프로젝트: macanhhuy/setman
def configure_settings(format):
    settings.configure(
        backend='setman.backends.filebased',
        filename=SETTINGS_DATA_FILE % {'format': format},
        format=format,
        settings_file=SETTINGS_FILE,
        settings_files=SETTINGS_FILES
    )
예제 #2
0
def configure_settings(format):
    settings.configure(backend='setman.backends.filebased',
                       filename=SETTINGS_DATA_FILE % {'format': format},
                       format=format,
                       settings_file=SETTINGS_FILE,
                       settings_files=SETTINGS_FILES)
예제 #3
0
파일: app.py 프로젝트: macanhhuy/setman
    logging.basicConfig(level=logging.INFO)

DIRNAME = os.path.abspath(os.path.dirname(__file__))
rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts))

SETMAN_ADDITIONAL_TYPES = ('testapp.utils.IPAddressSetting', )
SETMAN_SETTINGS_FILES = {'namespace': rel('namespace.cfg')}

app = Flask(__name__)
app.config.from_object(__name__)
app.secret_key = 't:\xc6\x1d\xcd\x86\xb7_\x11\x1e\xfe\xc1AD\x9f>'
app.static_folder = rel('..', '..', 'testproject-django', 'media')

settings.configure(framework='setman.frameworks.flask_setman',
                   app=app,
                   backend='setman.backends.filebased',
                   filename=rel('..', 'settings.json'),
                   format='json')


@app.route('/docs')
@app.route('/docs/<path>')
def docs(path=None):
    """
    View instructions on how to build documentation.
    """
    dirname = rel('..', '..')
    docs_dirname = rel('..', '..', 'docs', '_build', 'html')

    if not os.path.isdir(docs_dirname):
        return render_template('docs.html', dirname=dirname)
예제 #4
0
    logging.basicConfig(level=logging.INFO)

DIRNAME = os.path.abspath(os.path.dirname(__file__))
rel = lambda *parts: os.path.abspath(os.path.join(DIRNAME, *parts))

SETMAN_ADDITIONAL_TYPES = ('testapp.utils.IPAddressSetting', )
SETMAN_SETTINGS_FILES = {'namespace': rel('namespace.cfg')}

app = Flask(__name__)
app.config.from_object(__name__)
app.secret_key = 't:\xc6\x1d\xcd\x86\xb7_\x11\x1e\xfe\xc1AD\x9f>'
app.static_folder = rel('..', '..', 'testproject-django', 'media')

settings.configure(framework='setman.frameworks.flask_setman',
                   app=app,
                   backend='setman.backends.filebased',
                   filename=rel('..', 'settings.json'),
                   format='json')


@app.route('/docs')
@app.route('/docs/<path>')
def docs(path=None):
    """
    View instructions on how to build documentation.
    """
    dirname = rel('..', '..')
    docs_dirname = rel('..', '..', 'docs', '_build', 'html')

    if not os.path.isdir(docs_dirname):
        return render_template('docs.html', dirname=dirname)