test
This commit is contained in:
@@ -257,7 +257,6 @@ class Framework:
|
|||||||
# 아주 안좋은 구조..
|
# 아주 안좋은 구조..
|
||||||
# celery user_options으로 configfilepath를 받은 후 처리해야하나, 로그파일 경로 등에서 데이터 폴더 위치를 미리 사용하는 경우가 많다.
|
# celery user_options으로 configfilepath를 받은 후 처리해야하나, 로그파일 경로 등에서 데이터 폴더 위치를 미리 사용하는 경우가 많다.
|
||||||
# sys.argv에서 데이터 경로를 바로 가져와서 사용.
|
# sys.argv에서 데이터 경로를 바로 가져와서 사용.
|
||||||
|
|
||||||
self.config['arg_repeat'] = 0
|
self.config['arg_repeat'] = 0
|
||||||
self.config['arg_config'] = sys.argv[-1].split('=')[-1]
|
self.config['arg_config'] = sys.argv[-1].split('=')[-1]
|
||||||
#self.config['arg_config'] =
|
#self.config['arg_config'] =
|
||||||
@@ -268,14 +267,13 @@ class Framework:
|
|||||||
if self.config['arg_config'] == '.':
|
if self.config['arg_config'] == '.':
|
||||||
#self.config['config_filepath'] = os.path.join(self.path_app_root, 'config.yaml')
|
#self.config['config_filepath'] = os.path.join(self.path_app_root, 'config.yaml')
|
||||||
self.config['config_filepath'] = os.path.join(self.config['path_working'], 'config.yaml')
|
self.config['config_filepath'] = os.path.join(self.config['path_working'], 'config.yaml')
|
||||||
|
else:
|
||||||
|
self.config['config_filepath'] = self.config['arg_config']
|
||||||
if not os.path.exists(self.config['config_filepath']):
|
if not os.path.exists(self.config['config_filepath']):
|
||||||
shutil.copy(
|
shutil.copy(
|
||||||
os.path.join(self.path_app_root, 'files', 'config.yaml.template'),
|
os.path.join(self.path_app_root, 'files', 'config.yaml.template'),
|
||||||
self.config['config_filepath']
|
self.config['config_filepath']
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
self.config['config_filepath'] = self.config['arg_config']
|
|
||||||
|
|
||||||
#os.environ['FLASK_FARM_CONFIG_FILEPATH'] = self.config['config_filepath']
|
#os.environ['FLASK_FARM_CONFIG_FILEPATH'] = self.config['config_filepath']
|
||||||
#else:
|
#else:
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
# -*- coding: utf-8 -*-
|
import json
|
||||||
#########################################################
|
|
||||||
# python
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime, timedelta
|
|
||||||
import json
|
|
||||||
import traceback
|
import traceback
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
# third-party
|
import system
|
||||||
from flask import redirect, render_template, Response, request, jsonify, send_from_directory
|
from flask import (Response, jsonify, redirect, render_template, request,
|
||||||
from flask_login import login_user, logout_user, current_user, login_required
|
send_from_directory)
|
||||||
|
from flask_login import current_user, login_required, login_user, logout_user
|
||||||
|
|
||||||
# sjva 공용
|
# sjva 공용
|
||||||
from framework import F, check_api, app, db, VERSION, logger, path_data
|
from framework import VERSION, F
|
||||||
import system
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@F.app.route('/global/ajax/<sub>', methods=['GET', 'POST'])
|
@F.app.route('/global/ajax/<sub>', methods=['GET', 'POST'])
|
||||||
@@ -47,11 +43,11 @@ def global_ajax(sub):
|
|||||||
import flaskcode
|
import flaskcode
|
||||||
return jsonify(True)
|
return jsonify(True)
|
||||||
except:
|
except:
|
||||||
return jsonify(True)
|
return jsonify(False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/robots.txt')
|
@F.app.route('/robots.txt')
|
||||||
def robot_to_root():
|
def robot_to_root():
|
||||||
return send_from_directory('', 'static/file/robots.txt')
|
return send_from_directory('', 'static/file/robots.txt')
|
||||||
|
|
||||||
@@ -76,33 +72,33 @@ def robot_to_root():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@F.app.route("/")
|
||||||
@app.route("/None")
|
@F.app.route("/None")
|
||||||
@app.route("/home")
|
@F.app.route("/home")
|
||||||
def home():
|
def home():
|
||||||
return redirect('/system/home')
|
return redirect('/system/home')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/version")
|
@F.app.route("/version")
|
||||||
def get_version():
|
def get_version():
|
||||||
return VERSION
|
return VERSION
|
||||||
|
|
||||||
@app.route("/open/<path:path>")
|
@F.app.route("/open/<path:path>")
|
||||||
@login_required
|
@login_required
|
||||||
def open_file(path):
|
def open_file(path):
|
||||||
return send_from_directory('/', path)
|
return send_from_directory('/', path)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/file/<path:path>")
|
@F.app.route("/file/<path:path>")
|
||||||
@check_api
|
@F.check_api
|
||||||
def file2(path):
|
def file2(path):
|
||||||
logger.debug('file2 :%s', path)
|
F.logger.debug('file2 :%s', path)
|
||||||
return send_from_directory('/', path)
|
return send_from_directory('/', path)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/up", methods=['GET', 'POST'])
|
@F.app.route("/up", methods=['GET', 'POST'])
|
||||||
def upload():
|
def upload():
|
||||||
# curl -F file=@downloader_video.tar https://dev.soju6jan.com/up
|
# curl -F file=@downloader_video.tar https://dev.soju6jan.com/up
|
||||||
#
|
#
|
||||||
@@ -111,11 +107,11 @@ def upload():
|
|||||||
f = request.files['file']
|
f = request.files['file']
|
||||||
from werkzeug import secure_filename
|
from werkzeug import secure_filename
|
||||||
tmp = secure_filename(f.filename)
|
tmp = secure_filename(f.filename)
|
||||||
logger.debug('upload : %s', tmp)
|
F.logger.debug('upload : %s', tmp)
|
||||||
f.save(os.path.join(path_data, 'upload', tmp))
|
f.save(os.path.join(F.path_data, 'upload', tmp))
|
||||||
return jsonify('success')
|
return jsonify('success')
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
logger.error('Exception:%s', exception)
|
F.logger.error('Exception:%s', exception)
|
||||||
logger.error(traceback.format_exc())
|
F.logger.error(traceback.format_exc())
|
||||||
return jsonify('fail')
|
return jsonify('fail')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user