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()
|
18
zeronet.py
18
zeronet.py
|
@ -1,9 +1,13 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
try:
|
def main():
|
||||||
from src import main
|
try:
|
||||||
main.start()
|
from src import main
|
||||||
except Exception, err: # Prevent closing
|
main.start()
|
||||||
import traceback
|
except Exception, err: # Prevent closing
|
||||||
traceback.print_exc()
|
import traceback
|
||||||
raw_input("-- Error happened, press enter to close --")
|
traceback.print_exc()
|
||||||
|
raw_input("-- Error happened, press enter to close --")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in a new issue