Skip to content

Available commands

pyblade init

Creates a new PyBlade-powered project with the necessary initial directory structure and your preferred framemework configuration.

Usage

bash
pyblade init

This command will prompt you to provide the following details:

  • Project Name: Choose a name for your project.
  • Python Web Framework: Choose the Python Web framework you want to use for your project. Only Django is supported.
  • CSS Framework: Choose one either Bootstrap 5 or Tailwind CSS 4 for an automatic configuration or None if you want to manually configure it later or don't want to use a CSS Framework.
  • Use LiveBlade: Enable or disable Liveblade configuration, which adds additional features like real-time UI updates and dynamic components.

Common Issues & Troubleshooting

  • Error: "Permission denied"
    Solution: Ensure you have the correct permissions to create directories or run the command with elevated privileges using sudo.

pyblade serve

Starts a lightweight web server for development and also serves static files, allowing you to preview your project locally as you are coding.

Important

Don't use this command in a production environment.

Usage

bash
pyblade serve [<addrport>] [OPTIONS]

Arguments

ArgumentDescription
addrportOptional port number, or host address and port number in the format host:port (default: 127.0.0.1:8000)

Options

OptionDescription
-h --helpshow the help message and exit
--hostThe host address to run the server on (default: 127.0.0.1)
--portThe port number to run the server on (default: 8000).
-6 --ipv6Tells Django to use an IPv6 address.
--nothreadingTells Django to NOT use threading.
--noreloadTells Django to NOT use the auto-reloader.
--nostaticTells Django to NOT automatically serve static files at STATIC_URL.
--insecureAllows serving static files even if DEBUG is False.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Examples

bash
pyblade serve --host 0.0.0.0 --port 5000

This starts the development server at 0.0.0.0:5000.

Aliases

  • pyblade runserver

Common Issues & Troubleshooting

  • Error: "Address already in use"
    Solution: Check if another process is using the default port (8000). You can stop that process or specify a different port using the --port option.

pyblade convert

Migrates existing Django templates to the PyBlade templates by replacing Django Template tags and filters with their PyBlade equivalent. If the Django project uses custom templates and tags, they will remain unchanged. Make sure every thing works as expected after running this command.

Usage

bash
pyblade convert

pyblade make:template

Generates a new PyBlade template in the project root templates directory. This is typically a HTML file with basical structure.

Usage

bash
pyblade make:template <name>  [OPTIONS]

Arguments

ArgumentDescription
nameThe name, without extension, of the template to generate.

Options

OptionDescription
-h --helpshow the help message and exit
-f --forceOverride the template if already exists.

Examples

bash
pyblade make:template home

Aliases

  • pyblade maketemplate

This creates a new tempalates/home.html file.

Common Issues & Troubleshooting

  • Error: "Template already exists"
    Solution: Check the templates directory to see if a componenet with the same name (case sensitive) already exists. You can either override the existing component by using the --force option or choose a different name for your template

pyblade make:component

Generates a new PyBlade component. These components are reusable UI elements that can be embedded in templates.

Usage

bash
pyblade make:component <name>  [OPTIONS]

Arguments

ArgumentDescription
nameThe kebab-cased name of the PyBlade Component to generate.

Options

OptionDescription
-h --helpShow the help message and exit.
-f --forceOverride the component if already exists.

Examples

bash
pyblade make:component alert-box

This creates a new tempalates/components/alert-box.html file.

Common Issues & Troubleshooting

  • Error: "Component already exists"
    Solution: Check the templates/components directory to see if a componenet with the same name (kebab-cased) already exists. You can either override the existing component by using the --force option or choose a different name.

You can visit the PyBlade Components section of this documentation to learn more about using them.

pyblade make:liveblade

Creates a new Liveblade component for reactive UI rendering.

Usage

bash
pyblade make:liveblade <name> [OPTIONS]

Arguments

ArgumentDescription
nameThe kebab-cased name of the Liveblade component.

Options

OptionDescription
-h --helpShow the help message and exit.
-f --forceOverwrite the component if it already exists.

Examples

bash
pyblade make:liveblade counter

This creates two new files:

  • A liveblade/counter.py which holds the Python Component's class.
  • A templates/liveblade/couter.html file which holds the HTML Component's template.

Common Issues & Troubleshooting

  • Error: "Component already exists"
    Solution: Check the liveblade directory to see if a python file with the same name (snake_cased) already exists. Also Check the templates/liveblade directory to see if a HTML file with the same name (kebab-cased) already exists. You can either override the existing component by using the --force option or choose a different name.

You can visit the Liveblade Components section of this documentation to learn more about using them.

pyblade make:messages

Runs over the entire source tree of the project root directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the django tree) or locale (for projects and applications) directory.

Important

You must run this command with one of either the --locale --exclude, or --all options.

Usage

bash
pyblade make:messages [OPTIONS]

Options

OptionDescription
-h --helpshow the help message and exit
-l --localeCreates or updates the message files for the given locale(s) (e.g. en_US). Can be used multiple times.
-x --excludeLocales to exclude. Default is none. Can be used multiple times.
-a --allUpdates the message files for all existing locales.
-d --domainThe domain of the message files (default: django).
-e --extensionThe file extension(s) to examine (default: html,txt,py, or js if the domain is djangojs). Separate multiple extensions with commas, or use -e multiple times.
-s --symlinksFollows symlinks to directories when examining source code and templates for translation strings.
-i --ignoreIgnore files or directories matching this glob-style pattern. Use multiple times to ignore more.
--no-default-ignoreDon't ignore the common glob-style patterns CVS .* *~ and *.pyc.
--no-wrapDon't break long message lines into several lines.
--no-locationDon't write #: filename:line lines.
--add-location [{full,file,never}]Controls #: filename:line lines. If the option is full (the default if not given), the lines include both file name and line number. If it's file, the line number is omitted. If it's never, the lines are suppressed (same as --no-location). --add-location requires gettext 0.19 or newer.
--no-obsoleteRemove obsolete message strings.
--keep-potKeep .pot file after making messages. Useful when debugging.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
---pythonpath PYTHONPATHA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--tracebackDisplay a full stack trace on CommandError exceptions.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output

Examples

bash
pyblade make:messages --locale fr_FR

Aliases

  • pyblade makemessages
  • pyblade messages:make

pyblade make:migrations

Creates new database migration files for apps based on model changes.

Usage

bash
pyblade make:migrations [<app_label>] [OPTIONS]

Arguments

OptionDescription
app_labelOptional app label(s) that specifies the app(s) to create migrations for. Separate multiple apps with commas.

Options

OptionDescription
-h --helpshow the help message and exit
--dry-runJust show what migrations would be made; don't actually write them.
--mergeEnable fixing of migration conflicts.
--emptyCreate an empty migration.
--noinput --no-inputTells Django to NOT prompt the user for input of any kind.
-n --nameUse this name for migration file(s).
--no-headerDo not add header comments to new migration file(s).
--checkExit with a non-zero status if model changes are missing migrations and don't actually write them. Implies --dry-run.
--scriptableDivert log output and input prompts to stderr, writing only paths of generated migration files to stdout.
--updateMerge model changes into the latest migration and optimize the resulting operations.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Examples

bash
pyblade make:migrations

Aliases

  • pyblade makemigrations
  • pyblade make:migration
  • pyblade makemigration

pyblade app:start

Creates a Django app directory structure for the given app name in the current directory or optionally in the given directory.

Usage

bash
pyblade app:start <name> [<directory>] [OPTIONS]

Arguments

ArgumentDescription
nameThe name of the application.
directoryOptional destination directory.

Options

OptionDescription
-h --helpShow the help message and exit
-d --directoryThe destination directory
--templateThe path or URL to load the template from.
--extensionThe file extension(s) to render (default: py). Separate multiple extensions with commas, or use -e multiple times.
-n --nameThe file name(s) to render. Separate multiple file names with commas, or use -n multiple times.
x --excludeThe directory name(s) to exclude, in addition to .git and __pycache__. Can be used multiple times.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.

Examples

bash
pyblade app:start blog apps

This will create a new application folder in the apps directory.

Aliases

  • pyblade startapp
  • pyblade start:app

pyblade messages:compile

Compiles .po files to .mo files for use with builtin gettext support.

Usage

bash
pyblade messages:compile [OPTIONS]

Options

OptionDescription
-h --helpShow the help message and exit.
-l --localeLocale(s) to process (e.g. de_AT). Default is to process all. Can be used multiple times.
-x --excludeLocales to exclude. Default is none. Can be used multiple times.
-f --use-fuzzy,Use fuzzy translations.
-i --ignoreIgnore directories matching this glob-style pattern. Use multiple times to ignore more.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Examples

bash
pyblade messages:compile

Aliases

  • pyblade compile:messages
  • pyblade compilemessages

Common Issues & Troubleshooting

  • Error: "Missing .po files"

    Solution: Run pyblade make:messages first to generate translation files.

pyblade migrate

Updates database schema. Manages both apps with migrations and those without.

Usage

bash
pyblade migrate [<app_label>] [<migration_name>] [OPTIONS]

Arguments

ArgumentDescription
app_labelApp label of an application to synchronize the state. This is an optional argument.
migration_nameDatabase state will be brought to the state after that migration. Use the name zero to unapply all migrations. This is an optional argument.

Options

OptionDescription
-h --helpshow the help message and exit.
--noinput --no-inputTells Django to NOT prompt the user for input of any kind.
--database {default}Nominates a database to synchronize. Defaults to the default database.
--fakeMark migrations as run without actually running them.
--fake-initialDetect if tables already exist and fake-apply initial migrations if so. Make sure that the current database schema matches your initial migration before using this flag. Django will only check for an existing table name.
--planShows a list of the migration actions that will be performed.
--run-syncdbCreates tables for apps without migrations.
--checkExits with a non-zero status if unapplied migrations exist and does not actually apply migrations.
--pruneDelete nonexistent migrations from the django_migrations table.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Examples

bash
pyblade migrate blog --plan

Aliases

  • pyblade db:migrate

pyblade db:shell

Runs the command-line client for specified database, or the default database if none is provided.

Usage

bash
pyblade db:shell [OPTIONS]

Options

OptionDescription
-h --helpShow the help message and exit.
-d --database {default}Nominates a database onto which to open a shell. Defaults to the default database.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.

Examples

bash
pyblade db:shell

Aliases

  • pyblade dbshell

pyblade shell

Runs an interactive Python interpreter. Tries to use IPython or bpython, if one of them is available. Any standard input is executed as code.

Usage

bash
pyblade shell [OPTIONS]

Options

OptionDescription
-h --helpShow the help message and exit.
--no-startupWhen using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.
--no-importsDisable automatic imports of models.
-i --interface {ipython,bpython,python}Specify an interactive interpreter interface. Available options: ipython, bpython and python
-c --commandInstead of opening an interactive shell, run a command as Django and exit.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.

Examples

bash
pyblade shell

pyblade static:collect

Collects all static files into a single location (typically for deployment).

Usage

bash
pyblade static:collect [OPTIONS]

Options

OptionDescription
-h, --helpShow this help message and exit
--noinput, --no-inputDo NOT prompt the user for input of any kind.
--no-post-processDo NOT post process collected files.
-i --ignoreIgnore files or directories matching this glob-style pattern. Use multiple times to ignore more.
-n, --dry-runDo everything except modify the filesystem.
-c, --clearClear the existing files using the storage before trying to copy or link the original file.
-l, --linkCreate a symbolic link to each file instead of copying.
--no-default-ignoreDon't ignore the common private glob-style patterns (defaults to CVS .* and *~).
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Examples

bash
pyblade static:collect

Aliases

  • pyblade collectstatic
  • pyblade collect:static

pyblade superuser:create

Creates a superuser account.

Usage

bash
pyblade superuser:create [OPTIONS]

Options

OptionDescription
-h, --helpShow this help message and exit
--usernameSpecifies the login for the superuser.
--noinput --no-inputTells Django to NOT prompt the user for input of any kind. You must use --username with --noinput, along with an option for any other required field. Superusers created with --noinput will not be able to log in until they're given a valid password.
--database {default}Specifies the database to use. Default is default.
--email Specifies the email for the superuser.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.
--skip-checksSkip system checks.

Aliases

  • pyblade createsuperuser
  • pyblade create:superuser
  • pyblade su:create

pyblade route:list

Displays a list of all registered routes (URL patterns) in the application. Useful for debugging route definitions and HTTP methods.

Usage

bash
pyblade route:list

pyblade test

Discover and run tests in the specified modules or the current directory if no module is specified.

Usage

bash
pyblade test [<test_label>] [OPTIONS]

Arguments

ArgumentDescription
test_labelModule paths to test. Can be modulename, modulename.TestCase or modulename.TestCase.test_method. This is oprional.

Options

OptionDescription
-h, --helpShow the help message and exit
--noinput, --no-inputTells Django to NOT prompt the user for input of any kind.
--testrunnerTells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.
--failfastStops the test suite after the first failure.
-t, --top-level-directoryTop level of project for unittest discovery.
-p --patternThe test matching pattern. Defaults to test*.py.
--keepdbPreserves the test DB between runs.
--shuffle [SEED]Shuffles test case order.
-r, --reverseReverses test case order.
--debug-modeSets settings.DEBUG to True.
-d, --debug-sqlPrints logged SQL queries on failure.
--parallel [N]Run tests using up to N parallel processes. Use the value auto to run one test process for each processor core.
--tagRun only tests with the specified tag. Can be used multiple times.
--exclude-tag Do not run tests with the specified tag. Can be used multiple times.
--pdbRuns a debugger (pdb, or ipdb if installed) on error or failure.
-b, --bufferDiscard output from passing tests.
--no-faulthandlerDisables the Python faulthandler module during tests.
--timingOutput timings, including database set up and total run time.
-kOnly run test methods and classes that match the pattern or substring. Can be used multiple times. Same as unittest -k option.
-v --verbosity {0,1,2,3}Verbosity level. Use 0 for minimal output, 1 for normal output, 2 for verbose output or 3 for very verbose output.
--settingsThe Python path to a settings module, e.g. myproject.settings.main. If this isn't provided, the DJANGO_SETTINGS_MODULE environment variable will be used.
--pythonpathA directory to add to the Python path, e.g. /home/djangoprojects/myproject.
--no-colorDon't colorize the command output.
--force-colorForce colorization of the command output.

Examples

bash
pyblade test
pyblade test blog

pyblade cache:clear

Clears all cached data from the application. Use this after updating config or template files to ensure fresh values are used.

Usage

bash
pyblade cache:clear

pyblade config:cache

Caches the configuration files to speed up application boot time. This command compiles all configuration into a single cache file for optimized performance.

Usage

bash
pyblade config:cache

pyblade info

Displays information about the current PyBlade project and environment.

Usage

bash
pyblade info

pyblade update

Updates PyBlade to the latest available version.

Usage

bash
pyblade update

pyblade docs

Opens the PyBlade CLI documentation in your default browser.

Usage

bash
pyblade docs

Examples

bash
pyblade docs