Fixing an issue you couldn't create a configuration because one did not yet exist.

This commit is contained in:
kevgliss 2015-07-02 14:12:39 -07:00
parent 2856d13a4e
commit eadfaaeed0
4 changed files with 32 additions and 9 deletions

View File

@ -62,8 +62,3 @@ def configure_hook(app):
response.status_code = 403 response.status_code = 403
return response return response

24
lemur/default.conf.py Normal file
View File

@ -0,0 +1,24 @@
# This is just Python which means you can inherit and tweak settings
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
ADMINS = frozenset([''])
THREADS_PER_PAGE = 8
#############
## General ##
#############
# These will need to be set to `True` if you are developing locally
CORS = False
debug = False
#############
## Logging ##
#############
LOG_LEVEL = "DEBUG"
LOG_FILE = "lemur.log"

View File

@ -88,11 +88,11 @@ def configure_app(app, config=None):
except RuntimeError: except RuntimeError:
if config and config != 'None': if config and config != 'None':
app.config.from_object(from_file(config)) app.config.from_object(from_file(config))
else: elif os.path.isfile(os.path.expanduser("~/.lemur/lemur.conf.py")):
app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py"))) app.config.from_object(from_file(os.path.expanduser("~/.lemur/lemur.conf.py")))
else:
app.config.from_object(from_file(os.path.join(os.getcwd(), 'default.conf.py')))
if not app.config.get('LEMUR_ENCRYPTION_KEY'):
raise NoEncryptionKeyFound
def configure_extensions(app): def configure_extensions(app):

View File

@ -495,7 +495,7 @@ def create_config(config_path=None):
sys.stdout.write("Created a new configuration file {0}\n".format(config_path)) sys.stdout.write("Created a new configuration file {0}\n".format(config_path))
if __name__ == "__main__": def main():
manager.add_command("start", LemurServer()) manager.add_command("start", LemurServer())
manager.add_command("runserver", Server(host='127.0.0.1')) manager.add_command("runserver", Server(host='127.0.0.1'))
manager.add_command("clean", Clean()) manager.add_command("clean", Clean())
@ -506,3 +506,7 @@ if __name__ == "__main__":
manager.add_command('create_role', CreateRole()) manager.add_command('create_role', CreateRole())
manager.add_command("sync", Sync()) manager.add_command("sync", Sync())
manager.run() manager.run()
if __name__ == "__main__":
main()