Skip to content

Useful commands

OscarPDR edited this page Oct 31, 2014 · 2 revisions

If you happen to be a terminal hard-user, never fancing a colourful GUI, you can manage in great detail labman_ud's web application. The following commands are a summarization of the most useful ones, and they are launched in the following way:

(virtualenv) labman_ud/labman_ud/ > python manage.py command --settings=labman_ud.settings.[base|local|prod]

  • help

Prints the full list of available commands to be used.

  • runserver

Launches labman_ud's web application thanks to django's built-in development server.

  • migrate

Either if you need to create the database from scratch, or if any model in labman_ud gets updated and you have a running database already filled, you will need to adapt the data to fit the new model schema. Django now provides migrations natively, as explained in the official documentation.

  • shell

Launches a python shell with the project loaded, in order to have access to settings, database models, etc.

  • createsuperuser

In order to create system user's with admin privileges, type this command and follow the instructions from the prompt.

  • generate_secret_key

To fill the SECRET_KEY variable in the settings file, this command will give you a unique string.

  • collectstatic

When in a production environment, django is not able to serve static files. This command gathers all the static files of your apps in order to serve them on a public domain. collectstatic needs to be called each time a static file is updated.

Clone this wiki locally