ソースを参照

deploy client without debug in README

Eren Yilmaz 6 年 前
コミット
468abb1e84
10 ファイル変更17 行追加11 行削除
  1. 7 1
      README.md
  2. 1 2
      client_controller.py
  3. 1 1
      connection.py
  4. 1 1
      db_setup.py
  5. 1 0
      debug.py
  6. 2 1
      model.py
  7. 1 1
      run_client.py
  8. 1 1
      run_server.py
  9. 1 1
      server_controller.py
  10. 1 2
      util.py

+ 7 - 1
README.md

@@ -4,11 +4,17 @@
 The server is intended to be run within a python 3.6 environment on the host specified in `connection.py`.
 The client is intended to be compiled with
 ```
-pyinstaller run_client.py
+echo debug = False > debug.py &&\
+python -OO -m PyInstaller run_client.py &&\
+echo debug = True > debug.py
 ```
 where `pyinstaller` can be installed using pip.
 
 On the server you can install the required packages using pip:
 ```
 pip3 install bottle requests
+```
+and start the server using
+```
+python3 -OO run_server.py
 ```

+ 1 - 2
client_controller.py

@@ -7,8 +7,7 @@ from run_client import allowed_commands, fake_loading_bar
 from connection import client_request
 from tabulate import tabulate
 
-from util import debug
-
+from debug import debug
 
 exiting = False
 

+ 1 - 1
connection.py

@@ -2,7 +2,7 @@ import json
 
 import requests
 
-from util import debug
+from debug import debug
 
 port = 8451
 if debug:

+ 1 - 1
db_setup.py

@@ -1,5 +1,5 @@
 from game import CURRENCY_NAME
-from util import debug
+from debug import debug
 
 replace = True and debug
 

+ 1 - 0
debug.py

@@ -0,0 +1 @@
+debug = True

+ 2 - 1
model.py

@@ -8,7 +8,8 @@ from math import floor
 
 import db_setup
 from game import CURRENCY_NAME
-from util import debug, random_chars
+from util import random_chars
+from debug import debug
 
 # connection: db.Connection = None
 # cursor: db.Cursor = None

+ 1 - 1
run_client.py

@@ -4,7 +4,7 @@ import time
 
 import client_controller
 
-from util import debug
+from debug import debug
 
 
 def fake_loading_bar(msg, duration=5.):

+ 1 - 1
run_server.py

@@ -6,7 +6,7 @@ import model
 from bottle import run, response, route
 
 from server_controller import not_found
-from util import debug
+from debug import debug
 
 if __name__ == '__main__':
     print('sqlite3.version', model.db.version)

+ 1 - 1
server_controller.py

@@ -3,7 +3,7 @@ import json
 from bottle import request, response
 
 import model
-from util import debug
+from debug import debug
 
 
 def missing_attributes(attributes):

+ 1 - 2
util.py

@@ -1,9 +1,8 @@
 from random import random
 
-debug = __debug__
 chars = [str(d) for d in range(1, 10)]
 
-ps = [1. for _ in chars]
+ps = [2. for _ in chars]
 letter_dist = [("E", 21912, 12.02), ("T", 16587, 9.1), ("A", 14810, 8.12), ("O", 14003, 7.68), ("I", 13318, 7.31),
                ("N", 12666, 6.95), ("S", 11450, 6.28), ("R", 10977, 6.02), ("H", 10795, 5.92), ("D", 7874, 4.32),
                ("L", 7253, 3.98), ("U", 5246, 2.88), ("C", 4943, 2.71), ("M", 4761, 2.61), ("F", 4200, 2.3),