There are a number of command line utilities help the forum administrator perform a range of tasks such as add or revoke administration privileges, back up and restore the forum data, fix database errors if such occur, etc.
To run these commands there is a general pattern:
cd project_directory
python manage.py some_command [possible arguments and parameters]
I.e. the commands are generally run from the project directory (the same one that contains your settings.py file) and they may use additional parameters and options.
The bulk of the management commands fall into this group and will probably be the most frequently used.
command | purpose |
---|---|
add_admin <user_id> | Turn user into an administrator <user_id> is a numeric user id of the account |
remove_admin <user_id> | Remove admin status from a user account - the opposite of the add_admin command |
add_askbot_user –user-name –email [–password] [–email-frequency] | Create a user account. If password is not given, an unusable password will be set. Possible values for the –email-frequency are: i, d, w, n that stand for instant, daily, weekly and never - respectively. The default value is w. The command does not create associations with any of the external login providers. |
dump_forum [–dump-name some_name] | Save forum contents into a file. –dump-name parameter is optional |
get_tag_stats [-u|-t] [-e] | Print tag subscription statistics, per tag (option -t) or per user (option -u), if option -e is given, empty records will be shown too (longer versions of the options are: –per-tag-subscription-counts for -t, –per-user-tag-subscription-counts for -u, and –print-empty for -e). |
load_forum <file_name> | Load forum data from a file saved by the dump_forum command |
load_stackexchange <file.zip> | Load SackExchange dump into Askbot. It is best to run this command on empty database. Also - before running, make sure that askbot.importers.stackexchange is in the list of installed apps within your settings.py file (it might also be necessary to run syncdb command to initiate the SE importer tables). |
rename_tags –from <from_tags> –to <to_tags> –user-id <user_id> | Rename, merge or split tags. User ID is the id of the user who will be assigned as the performer of the retag action. If more than is in the –from or the –to parameters then that parameter quoted, e.g. `–to “tag1 tag2”. If user id is not given, the administrator with the smallest id number will be automatically assigned. |
rename_tags_id –from <from_tag_ids> –to <to_tag_ids> –user_id <user_id> | This command is the same as rename_tags, but takes the tag id’s as arguments. |
delete_unused_tags | Permanently deletes tags that do not appear in any questions , including the questions that are themselves marked as deleted. |
Batch jobs are those that should be run periodically. A program called cron can run these commands at the specified times (please look up futher information about cron elsewhere).
command | purpose |
---|---|
send_email_alerts | Dispatches email alerts to the users according to their subscription settings. This command does not send iinstant” alerts because those are sent automatically and do not require a separate command. The most frequent alert setting that can be served by this command is “daily”, therefore running send_email_alerts more than twice a day is not necessary. |
Under certain circumstances (especially when using MySQL database with MyISAM storage engine or when venturing to adapt the software to your needs) some records in the database tables may become internally inconsistent. The commands from this section will help fix those issues.
Note
Data inconsistency in the Askbot project is considered as a critical error and as a matter of the project policy is addressed on the day of reporting. If you discover such issue - please report it at the forum or by email at admin@askbot.org
command | purpose |
---|---|
add_missing_subscriptions | adds default values of email subscription settings to users that lack them |
fix_answer_counts | recalculates answer counts for all questions |
fix_revisionless_posts | adds a revision record to posts that lack them |
The above commands are safe to run at any time, also they do not require additional parameters. In the future all these will be replaced with just one simple command.
Besides the commands designed to help run the forum, there are several aiming to help the developers of the Askbot project:
command | purpose |
---|---|
make_docs | Rebuild HTML documentation for the project |
jinja2_makemessages | Extract translatable strings into the .po files. Works exactly the same way as the django makemessages command but extracts strings from Jinja2 templates that are used by the Askbot project. Note: the jinja2_makemessages must be run from the askbot app directory, unlike all the remaining commands that are expected to be run from the site root directory. |