Skip to main content

python tools library for daemon or web application

Project description

Description

python tools library for daemon or web application

Dependency

  1. common

    setuptools == 20.2.2

  2. web application (wsgi framework use flask; database use postgresql)

    # web application

    • flask == 0.10.1

    • gunicorn == 19.3.0

    • gevent == 1.1.1

    # database application

    • oslo.db == 2.1.0

    • psycopg2 == 2.5.5

    • sqlalchemy == 0.9.9

  3. daemon application

    nothing

Methods

  1. daemon application

>>> from osmo.app.application import QApplication
>>> from osmo.core import log as logging
>>>
>>> LOG = logging.getLogger(__name__)
>>>
>>>
>>> class MyApplication(QApplication):
>>>     name = 'myapp'
>>>     version = 'v0.1'
>>>
>>>     def run(self):
>>>         logging.setup('myapp log')
>>>         LOG.info('myapp run')
>>>
  1. web application

>>> from osmo.web.wsgiapp import WsgiApplication
>>> from osmo.core import log as logging
>>>
>>> LOG = logging.getLogger(__name__)
>>>
>>>
>>> class TestApp(WsgiApplication):
>>>     name = "test_app"
>>>     version = "v1.0"
>>>
>>>     def init_flask_app(self):
>>>         super(TestApp, self).init_flask_app()
>>>         logging.setup("test_www")
>>>         LOG.info("test www app run.....")
>>>
>>>         app = self.flask_app
>>>         app.secret_key = 'haohaoxuexi,tiantianxiangshang.'
>>>         app.permanent_session_lefttime = timedelta(hours=24)
>>>
>>>         app.static_url_path = '/static'
>>>
>>>         app.template_folder = 'templates'
>>>         app.static_folder = 'static'
>>>
>>>
>>>         # Use app route
>>>         #@app.route('/')
>>>         #def index():
>>>         #    return render_template('index.html', page_title='jinlong')
>>>
>>>         # Use blueprint route
>>>         import views.index as index
>>>         app.register_blueprint(index.bp, url_prefix='')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osmo-0.3.0.tar.gz (25.6 kB view details)

Uploaded Source

File details

Details for the file osmo-0.3.0.tar.gz.

File metadata

  • Download URL: osmo-0.3.0.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for osmo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4c9a23d25b1ccb838cfffbdec5983c7fff8e9bd6bcc8aab0cdb8bfd27fc53b21
MD5 d101e95b6b42fce513bfc7d1e4195bf3
BLAKE2b-256 2a7dce84b1888d596274de95591b9493ace4ff8afe2f73a342a086b8b1b2f747

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page