working base project
This commit is contained in:
parent
2535006f02
commit
fad9f38422
22 changed files with 461 additions and 278 deletions
36
app.py
36
app.py
|
|
@ -22,13 +22,28 @@ logging.basicConfig(
|
|||
)
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app = Flask(__name__, static_folder=os.path.abspath('/app/static'))
|
||||
app.config['UPLOAD_FOLDER'] = 'uploads'
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
return render_template('base.html', page='project', settings='set', error=False)
|
||||
|
||||
|
||||
@app.route('/splitt')
|
||||
def splitt():
|
||||
return render_template('base.html', page='splitt', settings='set', error=False)
|
||||
|
||||
|
||||
@app.route('/merge')
|
||||
def merge():
|
||||
return render_template('base.html', page='merge', settings='set', error=False)
|
||||
|
||||
|
||||
@app.route('/ocr')
|
||||
def ocr():
|
||||
return render_template('base.html', page='ocr', settings='set', error=False)
|
||||
|
||||
|
||||
@app.route('/app/')
|
||||
|
|
@ -87,6 +102,23 @@ def get_single_pages_info(uuid):
|
|||
return response
|
||||
|
||||
|
||||
@app.route('/move_page/<uuid>/<from_page>/<to_page>')
|
||||
def move_page(uuid, from_page, to_page):
|
||||
try:
|
||||
pdf_project = pdf_project_manager(uuid4=uuid)
|
||||
logging.debug("int(from_page): ")
|
||||
logging.debug(int(from_page))
|
||||
logging.debug("int(to_page): ")
|
||||
logging.debug(int(to_page))
|
||||
pdf_project.move_page(from_location=int(from_page), to_location=int(to_page))
|
||||
response = jsonify({'status': 200, 'message': 'page moved successfully'})
|
||||
except Exception as e:
|
||||
logging.debug("There was an error: " + str(e))
|
||||
logging.debug("Stacktrace: " + str(traceback.format_exc()))
|
||||
response = jsonify({"status": 500, "error_message": e})
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/split_to_zip', methods=['POST'])
|
||||
def split_to_zip():
|
||||
if 'pdf_1' not in request.files:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue