uses Django to start the command line and script, so it can be easily used to develop Django framework, for example, the operation of database.

below, respectively, describes the use of methods.

django shell startup

boot command:

 $/data/python-virtualenv/apple/bin/python /data/example/apple/manage.py shell

django shell has configuration information of Django, which can use the framework of Django. For example, defining model as Apples can directly query all records using Apples.objects.all ().

 > a=Apples.objects.all () > print a

script path must be, for example, to create a script for reference. The gement/commands/AutoCheckTicket.py

code is as follows:

 coding: UTF-8 * - from django.core.management.base import BaseCommand from monitor. R.main_entry () 

implementation:

 $/data/python-virtualenv/apple/bin/python /data/example/apple/manage.py AutoCheckTicket 

above this use Django to start the command line and the execution of the script method is to share all of the contents of the small editor, hope to be large A home reference, and I hope you will support the script home.

that you might be interested in:


This concludes the body part

This paper fixed link:http://www.script-home.com/using-django-to-start-the-command-line-and-execute-script.html | Script Home | +Copy Link

Article reprint please specify:Using Django to start the command line and execute script | Script Home

You may also be interested in these articles!