Merge pull request #36 from volker48/start-cmd
start.py script to start the server and launch a new browser tab
This commit is contained in:
commit
ac211229a7
2 changed files with 27 additions and 7 deletions
16
start.py
Normal file
16
start.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
from multiprocessing import Process
|
||||
import sys
|
||||
import webbrowser
|
||||
import zeronet
|
||||
|
||||
def main():
|
||||
browser_name = sys.argv.pop() if len(sys.argv) >= 2 else None
|
||||
server = Process(target=zeronet.main)
|
||||
server.start()
|
||||
browser = webbrowser.get(browser_name)
|
||||
url = browser.open("http://127.0.0.1:43110", new=2)
|
||||
server.join()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,9 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
def main():
|
||||
try:
|
||||
from src import main
|
||||
main.start()
|
||||
except Exception, err: # Prevent closing
|
||||
except Exception, err: # Prevent closing
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
raw_input("-- Error happened, press enter to close --")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue