Tony Mack | 71592a5 | 2013-03-28 20:17:47 -0400 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | import os |
| 3 | import sys |
| 4 | |
Tony Mack | 2ff8622 | 2013-05-10 16:54:14 -0400 | [diff] [blame] | 5 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings") |
Tony Mack | 79a49c8 | 2013-06-15 23:51:57 -0400 | [diff] [blame^] | 6 | from planetstack.config import Config |
| 7 | from openstack.backend import Backend |
Tony Mack | 71592a5 | 2013-03-28 20:17:47 -0400 | [diff] [blame] | 8 | |
| 9 | if __name__ == '__main__': |
| 10 | |
Tony Mack | cd6bf66 | 2013-04-30 18:20:27 -0400 | [diff] [blame] | 11 | # bootstrap envirnment |
Tony Mack | 71592a5 | 2013-03-28 20:17:47 -0400 | [diff] [blame] | 12 | from django.core.management import ManagementUtility |
| 13 | config = Config() |
Tony Mack | e02d720 | 2013-03-29 11:23:56 -0400 | [diff] [blame] | 14 | url = "%s:%s" % (config.api_host, config.api_port) |
Tony Mack | 71592a5 | 2013-03-28 20:17:47 -0400 | [diff] [blame] | 15 | args = [__file__, 'runserver', url] |
Tony Mack | cd6bf66 | 2013-04-30 18:20:27 -0400 | [diff] [blame] | 16 | |
Tony Mack | cd6bf66 | 2013-04-30 18:20:27 -0400 | [diff] [blame] | 17 | |
Tony Mack | 79a49c8 | 2013-06-15 23:51:57 -0400 | [diff] [blame^] | 18 | backend = Backend() |
| 19 | backend.run() |
| 20 | |
Tony Mack | cd6bf66 | 2013-04-30 18:20:27 -0400 | [diff] [blame] | 21 | # start the server |
| 22 | server = ManagementUtility(args) |
Tony Mack | 745bf6e | 2013-04-17 11:06:35 -0400 | [diff] [blame] | 23 | server.execute() |