Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move command execution from manage.py into lighty.commands

  • Loading branch information...
commit 2d980f4e2bc2567eb188431a52303ae12385d76b 1 parent bdaa4bf
@GrAndSE authored
Showing with 27 additions and 21 deletions.
  1. +25 −0 lighty/commands.py
  2. +2 −21 manage.py
View
25 lighty/commands.py
@@ -0,0 +1,25 @@
+'''Tools for run commands in framework environment using simple manage.py
+script
+'''
+from lighty.conf import Settings
+from lighty.wsgi import commands
+
+def manage():
+ '''Manage script
+ '''
+ import argparse
+ parser = argparse.ArgumentParser(description='Lighty manage script',
+ usage='manage.py --config=conf.cfg command')
+ parser.add_argument('--config', default='conf.cfg', type=str,
+ help='configuration file')
+ parser.add_argument('command', default='run_server', type=str,
+ help='command to perform')
+ args = parser.parse_args()
+
+ try:
+ settings = Settings(args.config)
+ except Exception as e:
+ print(e)
+ else:
+ command = getattr(commands, args.command)
+ command(settings)
View
23 manage.py
@@ -1,24 +1,5 @@
#!/usr/bin/python
"""Manage script for running server or execute another commands
"""
-import argparse
-
-from lighty.conf import Settings
-from lighty.wsgi import commands
-
-parser = argparse.ArgumentParser(description='Lighty manage script',
- usage='manage.py --config=conf.cfg command')
-parser.add_argument('--config', default='conf.cfg', type=str,
- help='configuration file')
-parser.add_argument('command', default='run_server', type=str,
- help='command to perform')
-args = parser.parse_args()
-#config_file, command = parser.parse_args(['--config', 'command'])
-
-try:
- settings = Settings(args.config)
-except Exception as e:
- print(e)
-else:
- command = getattr(commands, args.command)
- command(settings)
+from lighty import commands
+commands.manage()
Please sign in to comment.
Something went wrong with that request. Please try again.