Command-Line Interface
The openviper command provides project scaffolding and a development
server. It is installed automatically with the framework and is the primary
entry point for creating new projects, generating app scaffolds, and running
the ASGI server.
Management commands (migrations, superuser creation, task workers, etc.) are
handled by the viperctl sub-command documented in Core & CLI.
Global options
openviper --version # print framework version
openviper --help # list all commands
create-project
Scaffold a new OpenViper project with settings, ASGI entry point, routes,
views, templates, and a .gitignore.
openviper create-project myblog
This creates the following layout:
myblog/
├── viperctl.py
├── .gitignore
├── static/
├── templates/
│ └── home.html
├── tests/
│ └── __init__.py
└── myblog/
├── __init__.py
├── settings.py
├── asgi.py
├── routes.py
└── views.py
Arguments:
Argument |
Type |
Description |
|---|---|---|
|
string |
Required. A valid Python identifier used as the project package name. |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
CWD |
Parent directory in which the project folder is created. |
Generated files:
File |
Purpose |
|---|---|
|
Per-project management CLI entry point ( |
|
|
|
ASGI application module that bootstraps |
|
Top-level route definitions wiring admin and root routers. |
|
Example async views (HTML home page and JSON API index). |
|
Starter Jinja2 template rendered by the home view. |
|
Standard Python |
A cryptographically random SECRET_KEY is generated and embedded in
settings.py for development. Set the ``SECRET_KEY`` environment
variable to a separate strong value in production.
After scaffolding, start the development server:
cd myblog
python viperctl.py start-server
create-app
Scaffold a new app package inside an existing OpenViper project. Delegates
to viperctl create-app (see Core & CLI).
openviper create-app blog
Arguments:
Argument |
Type |
Description |
|---|---|---|
|
string |
Required. A valid Python identifier used as the app package name. |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
CWD |
Target directory containing the project. |
run
Run an OpenViper ASGI application with uvicorn.
openviper run app
openviper run app.py
openviper run myproject.asgi:app
The TARGET argument is resolved as follows:
app.pyis stripped toapp(module import convention).module:attrsyntax selects a specific ASGI callable; the default attribute isapp.The current working directory is added to
sys.pathso bare module names resolve without installation.
Arguments:
Argument |
Type |
Description |
|---|---|---|
|
string |
Required. Module or |
Options:
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
|
Bind address. |
|
int |
|
Bind port. |
|
flag |
|
Auto-reload on file changes. When enabled, workers is forced to 1. |
|
int |
|
Number of worker processes (ignored when |
Examples:
# Development with auto-reload
openviper run app --reload
# Production with 4 workers
openviper run myproject.asgi:app --no-reload --workers 4
# Bind to all interfaces on port 8080
openviper run app --host 0.0.0.0 --port 8080
version
Print the installed OpenViper version.
openviper version
viperctl (sub-command)
Dispatches per-project management commands. Full documentation is in Core & CLI.
There are two ways to run viperctl commands:
1. ``openviper viperctl`` - works from any project directory:
# From inside any project directory, use '.' to target the CWD
openviper viperctl migrate .
openviper viperctl makemigrations .
openviper viperctl console .
openviper viperctl start-server .
# Or specify a module name explicitly
openviper viperctl migrate myproject
openviper viperctl --settings myproject.settings console
2. ``python viperctl.py`` - from a project that has a viperctl.py:
# Generated by 'openviper create-project'
cd myproject
python viperctl.py migrate
python viperctl.py makemigrations
python viperctl.py console
python viperctl.py start-server
Both approaches are equivalent. openviper viperctl auto-discovers
the project layout (root-layout or module-organized) from the current
working directory, while python viperctl.py uses the settings
module configured in the script.
Target resolution for ``openviper viperctl``:
.- auto-detect the project from the current working directory. For root-layout projects (e.g.examples/fx), the CWD itself is the app. For module-organized projects (e.g.examples/ai_moderation_platform), the single Python package subdirectory containingsettings.pyandmodels.py/routes.pyis detected automatically.myproject- a dotted module path resolved relative to the CWD.
Supported commands: makemigrations, migrate, console,
start-server, start-worker, collectstatic, test,
createsuperuser, changepassword.