manage_defernia.py — Defernia manager script

This scripts provides several subcommands that manage Defernia instances.

-c config
--config config

Required option. It specify the path of a configruation file.

If there’s no such file, it confirms would you create a such file.

$ manage_defernia.py --config instance.cfg
instance.cfg doesn't exist yet; would you create it? [y]
-h
--help

Show the help message and exit.

manage_defernia.py initdb — Database initialization

Creates tables into a database.

$ manage_defernia.py initdb --config instance.cfg

It doesn’t print anything unless errors happened.

manage_defernia.py runserver — Builtin development web server

Runs the development web server.

$ manage_defernia.py runserver --config instance.cfg
 * Running on http://127.0.0.1:5000/
-t host
--host host

The host to bind. Default is 127.0.0.1.

-p port
--port port

The port number to bind. Default is 5000.

-d
--no-debug

Disables the debug mode. Debug mode enabled by default.

-r
--no-reload

Don’t reload automatically even if a file has changed.

manage_defernia.py shell — Interactive shell

It’s similar to Python builtin interactive shell, but it also includes the following variables in the global scope:

engine (sqlalchemy.engine.base.Engine)
The SQLAlchemy connection to the database spcified by configuration.
session (defernia.orm.Session)
The SQLAlchemy session bound to the above engine.
g
The context local globals provided by Flask.
app (flask.Flask)
The Flask application instance.
defernia (module)
Defernia top-level package.
User (class)
Defernia user model class.
$ manage_defernia.py shell -c dev.cfg

>>>

Internal API

manage_defernia — Defernia manager script

manage_defernia.create_config_file(config_filename)

Creates a new config file.

manage_defernia.initdb()

Creates all tables needed by Defernia.