Command line interface¶
You can perform several operations from the command line using Django commands, Fleio commands and BASH scripts.
For Django and Fleio commands you need to activate the Python virtual environment first.
Activate the virtual environment¶
Package installation¶
Connect via SSH to the machine where Fleio is installed and run:
# following line is only needed on CentOS 7 to activate Python 3 (as Python 2 is default on CentOS)
if [ -e /opt/rh/rh-python35/enable ] ; then . /opt/rh/rh-python35/enable; fi
# activate the Python virtual environment
. /var/webapps/fleio/env/bin/activate
# go to the Fleio backend Django project directory
cd /var/webapps/fleio/project/
Now you have access to the Django standard commands as well as the Django commands added by Fleio.
Docker installation¶
Connect via SSH to the machine where Fleio is installed and run:
fleio bash
. /var/webapps/fleio/env/bin/activate
List the Django and Fleio commands¶
To see a list of available commands just run django help
. Note that django
is a shortcut for
python manage.py
. So you get the same effect if you run python manage.py help
.
Here’s the django help
output:
$ django help
Type 'manage.py help <subcommand>' for help on a specific subcommand.
Available subcommands:
[auth]
changepassword
createsuperuser
[authtoken]
drf_create_token
[contenttypes]
remove_stale_contenttypes
[core]
dbbackup
[django]
check
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
makemigrations
migrate
runserver
sendtestemail
shell
showmigrations
sqlflush
sqlmigrate
sqlsequencereset
squashmigrations
startapp
startproject
test
testserver
[django_extensions]
admin_generator
clean_pyc
clear_cache
compile_pyc
create_command
create_jobs
create_template_tags
delete_squashed_migrations
describe_form
drop_test_database
dumpscript
export_emails
find_template
generate_password
generate_secret_key
graph_models
mail_debug
merge_model_instances
notes
passwd
pipchecker
print_settings
print_user_for_session
reset_db
reset_schema
runjob
runjobs
runprofileserver
runscript
runserver_plus
set_default_site
set_fake_emails
set_fake_passwords
shell_plus
show_template_tags
show_templatetags
show_urls
sqlcreate
sqldiff
sqldsn
sync_s3
syncdata
unreferenced_files
update_permissions
validate_templates
[rest_framework]
generateschema
[sessions]
clearsessions
Django shell¶
The Django shell is a command line environment where you can run Python commands in the context of the Fleio project, that is the settings are loaded, including things like database connection settings.
To enter the Django shell run:
cd /var/webapps/fleio/project
django shell_plus
(this is the same as the standard django shell
, but also loads some stuff automatically, for instance the database
model classes are already imported).
Once you’re into the shell, you can can for instance list the Fleio users:
>>> AppUser.objects.all()
<QuerySet [<AppUser: demo2@demo2.com>, <AppUser: osuser489595>, <AppUser: demo>, <AppUser: demoadmin>]>
>>>
Just press CTRL + D to exit the Django shell or type in exit()
.
Reset admin password¶
You can change any Fleio user password from the command line, including the admin/staff user password.
Connect via SSH to the machine where Fleio is installed and activate the virtual environment.
Then run:
django changepassword <<USER NAME>>
If you can’t remember the username either, you can run a query on the Fleio database and see the list of users:
mysql fleio
MariaDB [fleio]> SELECT username FROM core_appuser;
+--------------+
| username |
+--------------+
| demoadmin |
| joen@doe.com |
+--------------+
2 rows in set (0.00 sec)