fix template error in bundled onefile exec
This commit is contained in:
parent
aa0cf11dd8
commit
645ae397b4
@ -10,6 +10,7 @@ from PIL import Image
|
|||||||
from flask import Flask, request, jsonify, render_template
|
from flask import Flask, request, jsonify, render_template
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
|
bundle_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Hi there!
|
Hi there!
|
||||||
@ -55,8 +56,6 @@ IMAGE_TYPES_MAPPING = {
|
|||||||
|
|
||||||
|
|
||||||
def load_engine():
|
def load_engine():
|
||||||
bundle_dir = getattr(sys, '_MEIPASS', os.path.abspath(os.path.dirname(__file__)))
|
|
||||||
|
|
||||||
JSON_CONFIG["assets_folder"] = os.path.join(bundle_dir, "assets")
|
JSON_CONFIG["assets_folder"] = os.path.join(bundle_dir, "assets")
|
||||||
JSON_CONFIG.update({
|
JSON_CONFIG.update({
|
||||||
"charset": "latin",
|
"charset": "latin",
|
||||||
@ -116,7 +115,7 @@ def process_image(image: Image) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def create_rest_server_flask():
|
def create_rest_server_flask():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__, template_folder=os.path.join(bundle_dir, 'templates'))
|
||||||
|
|
||||||
@app.route('/v1/image/alpr', methods=['POST'])
|
@app.route('/v1/image/alpr', methods=['POST'])
|
||||||
def alpr():
|
def alpr():
|
||||||
|
@ -1 +1 @@
|
|||||||
pyinstaller --noconfirm --onefile --console --add-data libs:. --add-data assets:assets --name easy-local-alpr-1.0.0-linux_x86_64 "alpr_api.py"
|
pyinstaller --noconfirm --onefile --console --add-data libs:. --add-data assets:assets --add-data static:static --add-data templates:templates --name easy-local-alpr-1.0.0-linux_x86_64 "alpr_api.py"
|
Loading…
Reference in New Issue
Block a user