Skip to content

Commit

Permalink
make sure a Nikola site exists
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jan 12, 2015
1 parent 50fd759 commit 61020cf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
26 changes: 15 additions & 11 deletions comet/__main__.py
Expand Up @@ -76,17 +76,21 @@ def write_users(arguments):

def devserver(arguments):
import comet.web
port = int(arguments['--port'])
url = 'http://localhost:{0}/'.format(port)
comet.web.configure_url(url)
comet.web.app.config['DEBUG'] = True

if arguments['--browser']:
webbrowser.open(url)

comet.web.app.logger.info(u"Comet CMS running @ {0}".format(url))
comet.web.app.run('localhost', port, debug=True)
return 0
if comet.web.app:
port = int(arguments['--port'])
url = 'http://localhost:{0}/'.format(port)
comet.web.configure_url(url)
comet.web.app.config['DEBUG'] = True

if arguments['--browser']:
webbrowser.open(url)

comet.web.app.logger.info(u"Comet CMS running @ {0}".format(url))
comet.web.app.run('localhost', port, debug=True)
return 0
else:
print("FATAL: no conf.py found")
return 255

if __name__ == '__main__':
main()
6 changes: 5 additions & 1 deletion comet/web.py
Expand Up @@ -844,4 +844,8 @@ def display_permission(user, permission):
'json': json,
'display_permission': display_permission})

configure_site()
if not os.path.exists('._COMET_NO_CONFIG') and os.path.exists('conf.py'):
configure_site()
else:
# no Nikola site available
app = None

0 comments on commit 61020cf

Please sign in to comment.