Compare commits
2 Commits
feat/insta
...
a568abeb49
| Author | SHA1 | Date | |
|---|---|---|---|
|
a568abeb49
|
|||
|
4652af3a2d
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -14,5 +14,5 @@ plugins/signatures.json
|
||||
user_data/
|
||||
customPlugins/
|
||||
cache/
|
||||
build/
|
||||
dist/
|
||||
build/
|
||||
2
main.py
2
main.py
@@ -1613,4 +1613,4 @@ if __name__ == '__main__':
|
||||
if "--debug" in sys.argv:
|
||||
app.run(debug=True,host='0.0.0.0')
|
||||
else:
|
||||
app.run(host='0.0.0.0',threaded=True)
|
||||
app.run(host='0.0.0.0')
|
||||
63
main.spec
63
main.spec
@@ -1,63 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
import compileall
|
||||
from PyInstaller.utils.hooks import collect_data_files
|
||||
import os
|
||||
|
||||
compileall.compile_dir('.', force=True)
|
||||
|
||||
|
||||
|
||||
datas = [
|
||||
('templates', 'templates'),
|
||||
('assets', 'assets'),
|
||||
('themes', 'themes'),
|
||||
('plugins', 'plugins')
|
||||
]
|
||||
hiddenimports = [
|
||||
'plugins.automations',
|
||||
'plugins.batching',
|
||||
'plugins.customPlugins',
|
||||
'plugins.renewal',
|
||||
'plugins.varo'
|
||||
]
|
||||
|
||||
# Copy the plugins folder to the dist folder
|
||||
os.system(f'cp -r plugins dist/')
|
||||
|
||||
a = Analysis(
|
||||
['main.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=datas,
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
name='FireWallet',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=False,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
onefile=False,
|
||||
)
|
||||
@@ -8,4 +8,5 @@ cryptography
|
||||
requests-doh
|
||||
Flask-QRcode
|
||||
PySocks
|
||||
python-git-info
|
||||
python-git-info
|
||||
waitress
|
||||
66
server.py
66
server.py
@@ -1,38 +1,52 @@
|
||||
from flask import Flask
|
||||
from main import app
|
||||
import main
|
||||
from gunicorn.app.base import BaseApplication
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
from main import app
|
||||
from waitress import serve
|
||||
|
||||
|
||||
class GunicornApp(BaseApplication):
|
||||
def __init__(self, app, options=None):
|
||||
self.options = options or {}
|
||||
self.application = app
|
||||
super().__init__()
|
||||
threads = 4
|
||||
|
||||
def load_config(self):
|
||||
for key, value in self.options.items():
|
||||
if key in self.cfg.settings and value is not None:
|
||||
self.cfg.set(key.lower(), value)
|
||||
def gunicornServer():
|
||||
from gunicorn.app.base import BaseApplication
|
||||
class GunicornApp(BaseApplication):
|
||||
def __init__(self, app, options=None):
|
||||
self.options = options or {}
|
||||
self.application = app
|
||||
super().__init__()
|
||||
|
||||
def load(self):
|
||||
return self.application
|
||||
def load_config(self):
|
||||
for key, value in self.options.items():
|
||||
if key in self.cfg.settings and value is not None:
|
||||
self.cfg.set(key.lower(), value)
|
||||
|
||||
if __name__ == '__main__':
|
||||
workers = 1
|
||||
threads = 2
|
||||
if workers is None:
|
||||
workers = 1
|
||||
if threads is None:
|
||||
threads = 2
|
||||
workers = int(workers)
|
||||
threads = int(threads)
|
||||
def load(self):
|
||||
return self.application
|
||||
options = {
|
||||
'bind': '0.0.0.0:5000',
|
||||
'workers': workers,
|
||||
'workers': 2,
|
||||
'threads': threads,
|
||||
}
|
||||
gunicorn_app = GunicornApp(app, options)
|
||||
print('Starting server with ' + str(workers) + ' workers and ' + str(threads) + ' threads', flush=True)
|
||||
print(f'Starting server with Gunicorn on {platform.system()} with {threads} threads...', flush=True)
|
||||
gunicorn_app.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Check if --gunicorn is in the command line arguments
|
||||
if "--gunicorn" in sys.argv:
|
||||
gunicornServer()
|
||||
sys.exit()
|
||||
|
||||
print(f'Starting server with Waitress on {platform.system()} with {threads} threads...', flush=True)
|
||||
print(f'Press Ctrl+C to stop the server', flush=True)
|
||||
print(f'Serving on http://0.0.0.0:5000/', flush=True)
|
||||
serve(app, host="0.0.0.0", port=5000, threads=threads)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user