Package ajango :: Package contrib :: Package automatic :: Package management :: Package commands :: Module makeskeleton
[hide private]
[frames] | no frames]

Source Code for Module ajango.contrib.automatic.management.commands.makeskeleton

 1  ########################################################################### 
 2  #                                                                         # 
 3  #  Copyright (C) 2016  Rafal Kobel <rafyco1@gmail.com>                    # 
 4  #                                                                         # 
 5  #  This program is free software: you can redistribute it and/or modify   # 
 6  #  it under the terms of the GNU General Public License as published by   # 
 7  #  the Free Software Foundation, either version 3 of the License, or      # 
 8  #  (at your option) any later version.                                    # 
 9  #                                                                         # 
10  #  This program is distributed in the hope that it will be useful,        # 
11  #  but WITHOUT ANY WARRANTY; without even the implied warranty of         # 
12  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the           # 
13  #  GNU General Public License for more details.                           # 
14  #                                                                         # 
15  #  You should have received a copy of the GNU General Public License      # 
16  #  along with this program.  If not, see <http://www.gnu.org/licenses/>.  # 
17  #                                                                         # 
18  ########################################################################### 
19  """ 
20  Polecenie generujace szkielet aplikacji. 
21   
22  Polecenie pozwala na wygenerowanie szkieletu projektu w formie pliku XML. 
23  Niezbedne do jego dzialania jest wygenerowanie pliku projektowego systemu 
24  I{Django} z ustawiona aplikacja I{Ajango}. Wiecej informacji na ten temat 
25  w L{ajango}. 
26   
27  Gotowy plik mozna edytowac zgodnie z opisem w L{ajango.generator} a nastepnie 
28  wygenerowac aplikacje poleceniem 
29  L{generateapps <ajango.contrib.automatic.management.commands.generateapps>} 
30   
31  Skladnia polecenia 
32  ================== 
33   
34  Przykladowe wywolanie polecenia:: 
35   
36      $ python manager.py makeskeleton . 
37   
38  Znak kropki oznacza adres docelowym w ktorym zostanie wygenerowany plik. 
39  """ 
40   
41  from django.core.management.templates import TemplateCommand 
42  import ajango 
43   
44 -class Command(TemplateCommand):
45 """ 46 Generowanie szablonu szkieletu. 47 48 Polecenie generuje szkielet aplikacji z ktorego potem nastapi automatyczne 49 generowanie pliku. Aplikacje opisane sa w formacie XML a ich generowanie 50 nastepuje po wykonianu polecenia C{generateapps} dostepnego w skrypcie 51 frameworka Django. 52 """ 53 help = ("Creates a Ajango skeleton file.") 54 missing_args_message = "You must provide an application name."
55 - def add_arguments(self, parser):
56 """ Definiowanie argumentow. """ 57 parser.add_argument('directory', nargs='?', 58 help='Optional destination directory') 59 parser.add_argument('--template', 60 help='The path or URL to load the template from.') 61 parser.add_argument( 62 '--extension', '-e', dest='extensions', 63 action='append', default=['py'], 64 help='The file extension(s) to render (default: "py"). ' 65 'Separate multiple extensions with commas, or use ' 66 '-e multiple times.' 67 ) 68 parser.add_argument( 69 '--name', '-n', dest='files', 70 action='append', default=[], 71 help='The file name(s) to render. Separate multiple extensions ' 72 'with commas, or use -n multiple times.' 73 )
74 - def handle(self, **options):
75 """ Obsluga polecenia. """ 76 skeleton_name = "name" 77 target = options.pop('directory') 78 # Check that the skeleton_name cannot be imported. 79 options['template'] = ajango.__path__[0] + '/conf/skeleton_template' 80 super(Command, self).handle('skeleton', skeleton_name, 81 target, **options)
82