Listen per default to the public

This commit is contained in:
Oskar Hahn 2013-06-13 14:36:38 +02:00
parent 7951c25a42
commit 6dad2e5161

View File

@ -178,15 +178,10 @@ def _main(opts, database_path=None):
# Find url to openslides # Find url to openslides
addr, port = detect_listen_opts(opts.address, opts.port) addr, port = detect_listen_opts(opts.address, opts.port)
if port == 80:
url = "http://%s" % addr
else:
url = "http://%s:%d" % (addr, port)
# Create Database if necessary # Create Database if necessary
if not database_exists() or opts.syncdb: if not database_exists() or opts.syncdb:
run_syncdb() run_syncdb()
set_system_url(url)
create_or_reset_admin_user() create_or_reset_admin_user()
# Reset Admin # Reset Admin
@ -205,7 +200,11 @@ def _main(opts, database_path=None):
reload = False reload = False
if opts.start_browser: if opts.start_browser:
start_browser(url) if port == 80:
suffix = ""
else:
suffix = ":%d" % port
start_browser("http://localhost%s" % suffix)
# Start the server # Start the server
run_tornado(addr, port, reload) run_tornado(addr, port, reload)
@ -252,10 +251,7 @@ def setup_django_environment(settings_path):
def detect_listen_opts(address=None, port=None): def detect_listen_opts(address=None, port=None):
if address is None: if address is None:
try: address = "0.0.0.0"
address = socket.gethostbyname(socket.gethostname())
except socket.error:
address = "127.0.0.1"
if port is None: if port is None:
# test if we can use port 80 # test if we can use port 80
@ -298,15 +294,6 @@ def run_syncdb():
execute_from_command_line(argv) execute_from_command_line(argv)
def set_system_url(url):
# can't be imported in global scope as it already requires
# the settings module during import
from openslides.config.api import config
if config['participant_pdf_system_url'] == 'http://example.com:8000':
config['participant_pdf_system_url'] = url
def create_or_reset_admin_user(): def create_or_reset_admin_user():
# can't be imported in global scope as it already requires # can't be imported in global scope as it already requires
# the settings module during import # the settings module during import