Exemple #1
0
# coding:utf-8

from main import app_factory
from config import project_name
import os

try:
    config_obj_path = os.environ['FLASK_CONFIG_DEFAULT']
except KeyError as e:
    print("Please, provide the environment variable FLASK_CONFIG_DEFAULT. It is required.")
    exit()

app = app_factory(config_obj_path, project_name)


if __name__ == '__main__':
    args = (app,)
    kwargs = {
        'host': '0.0.0.0',
        'port': 5000,
        'debug': os.getenv('FLASK_DEBUG', '0') == '1',
        'use_reloader': os.getenv('FLASK_DEBUG', '0') == '1',
    }

    {% if cookiecutter.use_socketio -%}
    from extensions import io
    io.run(*args, **kwargs)
    {% else %}
    app.run(*args, **kwargs)
    {% endif %}
                <div class="row">
                For deployment, just remember to setup your swarm secrets and
                you should be ready to go. If you wish to help, create an issue
                for any bugs that you find and leave a star. PR's are welcomed.
                </div>
                <div class="row">
                    <div class="ui horizontal list">
                        <div class="item">
                        <a target="_blank" href="https://github.com/italomaia/flask-empty-api">Github</a>
                        </div>
                        <div class="item">
                            <a target="_blank" href="https://github.com/italomaia">Author</a>
                        </div>
                    </div>
                </div>
            </div>
            </body></html>
            """

    def configure_error_handlers(self):
        """SPA"""
        pass


if __name__ == '__main__':
    from auto import app
    from extensions import io

    io.run(app)
Exemple #3
0
from config import project_name
import os

try:
    config_obj_path = os.environ['FLASK_CONFIG_DEFAULT']
except KeyError as e:
    print("Please, provide the environment variable FLASK_CONFIG_DEFAULT. It is required.")
    exit()

app = app_factory(config_obj_path, project_name)


if __name__ == '__main__':
    _debug = app.config.get('DEBUG', False)

    kwargs = {
        'host': os.getenv('FLASK_HOST', '0.0.0.0'),
        'port': int(os.getenv('FLASK_PORT', 5000)),
        'debug': _debug,
        'use_reloader': app.config.get('USE_RELOADER', _debug),
        **app.config.get('SERVER_OPTIONS', {})
    }

    {% if uses_socketio -%}
    from extensions import io

    io.run(app, **kwargs)
    {% else %}
    app.run(**kwargs)
    {% endif %}
Exemple #4
0
# coding:utf-8

from main import app_factory
from config import project_name
import os

config_obj_path = os.environ['FLASK_CONFIG_DEFAULT']
app = app_factory(config_obj_path, project_name)


if __name__ == '__main__':
    args = (app,)
    kwargs = {
        'host': '0.0.0.0',
        'port': 5000,
        'debug': os.getenv('FLASK_DEBUG', '0') == '1',
        'use_reloader': os.getenv('FLASK_DEBUG', '0') == '1',
    }

    {% if cookiecutter.use_socketio -%}
    from extensions import io
    io.run(*args, **kwargs)
    {% else %}
    app.run(*args, **kwargs)
    {% endif %}