Skip to content

Commit 260dc07

Browse files
committed
added pyinstaller packaging for server and socket port changing
1 parent 62da9d0 commit 260dc07

9 files changed

Lines changed: 300 additions & 243 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ node_modules
99
**/__pycache__
1010
**/npm_modules
1111

12+
**/dist
13+
**/build
14+
1215
# local env files
1316
.env.local
1417
.env.*.local

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pip install -r requirements.txt
7272

7373
### Run
7474
```
75-
py app.py
75+
py server.py
7676
```
7777

7878

Server/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ pip install -r requirements.txt
1010
py app.py
1111
```
1212

13+
## Package
14+
````
15+
pyinstaller server.py --hidden-import engineio.async_drivers.aiohttp --hidden-import engineio.async_aiohttp
16+
17+
```
1318
1419
## Request Format
1520
Sensor data should be in raw uint format

Server/app.py renamed to Server/server.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
from concurrent.futures import ProcessPoolExecutor
55

66
sio = socketio.AsyncServer(async_mode='aiohttp',
7-
cors_allowed_origins=[
8-
'http://localhost:8080', 'http://localhost:8081', 'https://data.syn.bike'],
9-
max_http_buffer_size=1e9, ping_timeout=10)
10-
app = web.Application(client_max_size=1e10, debug=True)
7+
cors_allowed_origins=['http://localhost:8080',
8+
'http://localhost:8081',
9+
'https://data'],
10+
ping_timeout=10)
11+
app = web.Application()
1112
sio.attach(app)
1213

1314
import json
@@ -100,8 +101,6 @@ async def save_file(sid, data):
100101
if data['stage'] == 'end':
101102
print('End file stream')
102103
with open(filename, 'rb') as file:
103-
# print(hashlib.sha1(file.read()).hexdigest())
104-
# print(data['checksum'])
105104
if hashlib.sha1(file.read()).hexdigest() == data['checksum']:
106105
print('Is good file.')
107106
await sio.emit('file_loaded', {"valid": True})
@@ -115,8 +114,7 @@ async def save_file(sid, data):
115114

116115
@sio.on('close')
117116
def close_connection(sid):
118-
print('Closed')
119-
print(sid)
117+
print(f'Connection Closed with {sid}')
120118

121119

122120
def delete_file(filename, sid):
@@ -136,12 +134,12 @@ def close_connection(sid):
136134
"""
137135

138136
Timer(30, delete_file, [secure_filename(sid + '.csv'), sid]).start()
139-
print('disconnect')
137+
print('Disconnection detected.')
140138

141139

142140
@sio.on('connect')
143141
def open_connection(sid, data):
144-
print('connected')
142+
print('Client connected.')
145143
return True
146144

147145

@@ -152,7 +150,7 @@ def open_connection(sid, data):
152150
and rename if needed. This avoids the need to resend large files for
153151
short term disconnects.
154152
"""
155-
print('RECONNECTION')
153+
print('Reconnect detected.')
156154
new_filename = secure_filename(sid + '.csv')
157155
old_filename = secure_filename(data['id'] + '.csv')
158156

@@ -165,4 +163,4 @@ def open_connection(sid, data):
165163
if __name__ == '__main__':
166164
loop = asyncio.get_event_loop()
167165
executor = ProcessPoolExecutor()
168-
web.run_app(app, port=5000)
166+
web.run_app(app, port=5079)

Server/server.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
block_cipher = None
5+
6+
7+
a = Analysis(['server.py'],
8+
pathex=['C:\\Users\\Geoff\\GitPro\\synDAQ\\Server'],
9+
binaries=[],
10+
datas=[],
11+
hiddenimports=['engineio.async_drivers.aiohttp', 'engineio.async_aiohttp'],
12+
hookspath=[],
13+
runtime_hooks=[],
14+
excludes=[],
15+
win_no_prefer_redirects=False,
16+
win_private_assemblies=False,
17+
cipher=block_cipher,
18+
noarchive=False)
19+
pyz = PYZ(a.pure, a.zipped_data,
20+
cipher=block_cipher)
21+
exe = EXE(pyz,
22+
a.scripts,
23+
[],
24+
exclude_binaries=True,
25+
name='server',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
console=True )
31+
coll = COLLECT(exe,
32+
a.binaries,
33+
a.zipfiles,
34+
a.datas,
35+
strip=False,
36+
upx=True,
37+
upx_exclude=[],
38+
name='server')

WebApp/src/components/TabSettings.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
:value="plotData.state.plotStyle"
2424
@select="plotData.setData(['plotStyle', $event])"
2525
label="Large Plots" />
26+
<TextInputMD name="Processing Server Location"
27+
:modelValue="plotData.state.serverLoc"
28+
@submit="plotData.setData(['serverLoc', $event])" />
2629
</div>
2730
</template>
2831
<script>

0 commit comments

Comments
 (0)